Browse Source

SMTP: Added random Subjects, cleanup

Sebastian Lohff 7 years ago
parent
commit
bf8164c695
3 changed files with 17 additions and 14 deletions
  1. 1
    1
      tunnel/spam/README
  2. 0
    11
      tunnel/spam/conf.sample.py
  3. 16
    2
      tunnel/spam/spam.py

+ 1
- 1
tunnel/spam/README View File

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

+ 0
- 11
tunnel/spam/conf.sample.py View File

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

+ 16
- 2
tunnel/spam/spam.py View File

@@ -8,12 +8,13 @@ import asyncore
8 8
 import email
9 9
 from email.mime.text import MIMEText
10 10
 import imaplib
11
+import random
11 12
 import select
12 13
 import smtpd
13 14
 import smtplib
15
+import sys
14 16
 import time
15 17
 import threading
16
-import sys
17 18
 sys.path.append("../../../")
18 19
 
19 20
 from ether2any import Ether2Any
@@ -75,12 +76,14 @@ class SimpleSMTPServer(smtpd.SMTPServer):
75 76
 		smtpd.SMTPServer.__init__(self, *args, **kwargs)
76 77
 		self._handler = handler
77 78
 	def process_message(self, peer, mailfrom, mailto, data):
79
+		print "[SMTPD] Incoming mail"
78 80
 		# give mail to handler
79 81
 		self._handler.receiveMail(mailfrom, mailto, data)
80 82
 
81 83
 class SMTPServerThread(threading.Thread):
82 84
 	def __init__(self, listen, handler):
83 85
 		threading.Thread.__init__(self)
86
+		self.daemon = True
84 87
 		self.server = SimpleSMTPServer(handler, listen, None)
85 88
 	
86 89
 	def run(self):
@@ -89,6 +92,7 @@ class SMTPServerThread(threading.Thread):
89 92
 class SimpleIMAPClient(threading.Thread):
90 93
 	def __init__(self, imapConf, mailTo, handler):
91 94
 		threading.Thread.__init__(self)
95
+		self.daemon = True
92 96
 		self.imapConf = imapConf
93 97
 		self.imap = None
94 98
 		self.quit = False
@@ -227,9 +231,19 @@ class MailTunnel(Ether2Any):
227 231
 			self.smtp.sendmail(fromAddr, toAddrs, e.as_string())
228 232
 			print "Mail+reconnect took %fs" % (time.time()-t)
229 233
 	
234
+	def getRandomSubject(self):
235
+		return random.choice([
236
+			"Get laid TODAY!", "This is your chance", "Hello",
237
+			"Business proposal", "Your ad on 2 million websites",
238
+			"Make Money Online", "Assistance needed", "You WON!",
239
+			"Stop wasting time - buy viagra!", "She is waiting for you...",
240
+			"He is waiting for you...", "Your IP addres was logged!",
241
+			"Never be short again!", "Have your own traffic generator!",
242
+			"Credit report FRAUD ALERT", "It's time for you"])
243
+	
230 244
 	def sendToNet(self, packet):
231 245
 		data = self.generator.encode(packet)
232
-		self.sendMail(self.mailFrom, [self.mailTo], "Ohai!", data) 
246
+		self.sendMail(self.mailFrom, [self.mailTo], self.getRandomSubject(), data) 
233 247
 	
234 248
 	def sendToDev(self, socket):
235 249
 		pass

Loading…
Cancel
Save