Skip to content

Instantly share code, notes, and snippets.

@funzoneq
Created August 13, 2013 14:51
Show Gist options
  • Save funzoneq/6221957 to your computer and use it in GitHub Desktop.
Save funzoneq/6221957 to your computer and use it in GitHub Desktop.
tor2web for e-mail, in combination with http://styx.org/ww/2011/12/torfix.txt
import asyncore
from smtpd import SMTPServer
import smtplib
import email
class EmlToTorServer(SMTPServer):
no = 0
def process_message(self, peer, mailfrom, rcpttos, data):
torrcpttos = []
for r in rcpttos:
torrcpttos = r.replace("tor2web.org", "onion")
msg = email.message_from_string(data)
msg['To'] = torrcpttos
s = smtplib.SMTP('localhost', 2525)
s.sendmail(me, mailfrom, msg.as_string())
s.quit()
def run():
foo = EmlToTorServer(('localhost', 25), None)
try:
asyncore.loop()
except KeyboardInterrupt:
pass
if __name__ == '__main__':
run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment