SMTP: Added random Subjects, cleanup

master
Sebastian Lohff 12 years ago
parent 794b3fe5ab
commit bf8164c695

@ -43,10 +43,10 @@ As said in the section below: This needs to be implemented. ;)
What could be done What could be done
================== ==================
* add support to send mails directly via smtp, not via a specific smtp server
* allow the spam tunnel to run as an IP tunnel, configurable via config * allow the spam tunnel to run as an IP tunnel, configurable via config
* implement support for multiple clients * implement support for multiple clients
* support exchange of encoding dictionary prior to sending/receiving data * support exchange of encoding dictionary prior to sending/receiving data
* add support to send mails directly via smtp, not via a specific smtp server
Licensing Licensing

@ -75,17 +75,6 @@ Conf = {
# list of all allowed recipients, None for everyone # list of all allowed recipients, None for everyone
# e.g. ["foo@somedomain.de", "bar@someserver.de"] # e.g. ["foo@somedomain.de", "bar@someserver.de"]
'allowTo': None, 'allowTo': None,
# accept traffic (set to False, if only used as ARP-Server)
# Note: Nevertheless a tapdevice will be created and configured
'acceptTraffic': False,
},
# arp server, returns mac and mail addresses to arp-requests
'arpserv':
{
# timeout in seconds, when to throw old arps away
'timeout':
}, },
} }

@ -8,12 +8,13 @@ import asyncore
import email import email
from email.mime.text import MIMEText from email.mime.text import MIMEText
import imaplib import imaplib
import random
import select import select
import smtpd import smtpd
import smtplib import smtplib
import sys
import time import time
import threading import threading
import sys
sys.path.append("../../../") sys.path.append("../../../")
from ether2any import Ether2Any from ether2any import Ether2Any
@ -75,12 +76,14 @@ class SimpleSMTPServer(smtpd.SMTPServer):
smtpd.SMTPServer.__init__(self, *args, **kwargs) smtpd.SMTPServer.__init__(self, *args, **kwargs)
self._handler = handler self._handler = handler
def process_message(self, peer, mailfrom, mailto, data): def process_message(self, peer, mailfrom, mailto, data):
print "[SMTPD] Incoming mail"
# give mail to handler # give mail to handler
self._handler.receiveMail(mailfrom, mailto, data) self._handler.receiveMail(mailfrom, mailto, data)
class SMTPServerThread(threading.Thread): class SMTPServerThread(threading.Thread):
def __init__(self, listen, handler): def __init__(self, listen, handler):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.daemon = True
self.server = SimpleSMTPServer(handler, listen, None) self.server = SimpleSMTPServer(handler, listen, None)
def run(self): def run(self):
@ -89,6 +92,7 @@ class SMTPServerThread(threading.Thread):
class SimpleIMAPClient(threading.Thread): class SimpleIMAPClient(threading.Thread):
def __init__(self, imapConf, mailTo, handler): def __init__(self, imapConf, mailTo, handler):
threading.Thread.__init__(self) threading.Thread.__init__(self)
self.daemon = True
self.imapConf = imapConf self.imapConf = imapConf
self.imap = None self.imap = None
self.quit = False self.quit = False
@ -227,9 +231,19 @@ class MailTunnel(Ether2Any):
self.smtp.sendmail(fromAddr, toAddrs, e.as_string()) self.smtp.sendmail(fromAddr, toAddrs, e.as_string())
print "Mail+reconnect took %fs" % (time.time()-t) print "Mail+reconnect took %fs" % (time.time()-t)
def getRandomSubject(self):
return random.choice([
"Get laid TODAY!", "This is your chance", "Hello",
"Business proposal", "Your ad on 2 million websites",
"Make Money Online", "Assistance needed", "You WON!",
"Stop wasting time - buy viagra!", "She is waiting for you...",
"He is waiting for you...", "Your IP addres was logged!",
"Never be short again!", "Have your own traffic generator!",
"Credit report FRAUD ALERT", "It's time for you"])
def sendToNet(self, packet): def sendToNet(self, packet):
data = self.generator.encode(packet) data = self.generator.encode(packet)
self.sendMail(self.mailFrom, [self.mailTo], "Ohai!", data) self.sendMail(self.mailFrom, [self.mailTo], self.getRandomSubject(), data)
def sendToDev(self, socket): def sendToDev(self, socket):
pass pass

Loading…
Cancel
Save