#!/usr/bin/env python3 import sys import hashlib import codecs import os # Read and process the email address from command line arguments email = sys.argv[1].lower().strip() if email[0] == '<': email = email[1:] if email[-1] == '>': email = email[:-1] # Read the page argument (not used in this script but passed for compatibility) page = sys.argv[2] # Ensure correct encoding for stdin and stdout sys.stdin = codecs.getreader("utf-8")(sys.stdin.detach()) sys.stdout = codecs.getwriter("utf-8")(sys.stdout.detach()) # Calculate MD5 hash of the email md5 = hashlib.md5(email.encode()).hexdigest() # Read the standard input to get the buffer text buffer = sys.stdin.read().strip() # Determine the base URL based on HTTPS environment variable baseurl = "https://seccdn.libravatar.org/" if os.getenv("HTTPS") else "http://cdn.libravatar.org/" # Generate the HTML output with Libravatar images html_output = ( f"" f"Libravatar" f"Libravatar" f" {buffer}" ) # Print the HTML output print(html_output)