The code for anon.hmm.st, the cosmic.voyage ship.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

37 lines
851 B

#!/usr/bin/python3
import utils,sys,subprocess,traceback
utils.setcwd("/home/anonhmmst")
def log(x):
with utils.open("log.txt","a") as f:
f.write(x+"\n")
try:
email = utils.input()
except:
errcls,e,tb = sys.exc_info()
log(traceback.format_exception_only(errcls,e))
title = email.get("Subject")
payload = email.get_payload()
if type(payload)==list:
payload = {x.get_content_type(): x.get_payload() for x in payload}
if payload.get("text/plain") is not None:
payload = payload["text/plain"]
else:
sys.exit(0)
if "\r\n" in payload:
payload = payload.replace("\r\n","\n")
if payload==payload.rstrip():
payload+="\n"
log("title = {!r}".format(title))
log("payload = {!r}".format(payload))
filename = utils.get_name_from_title(title)
utils.write_file(filename,payload)
subprocess.run(["/usr/local/bin/log","-f",filename,"-t",title])