Skip to content

Commit d1ab586

Browse files
authored
Update madcatmailer.py
1 parent 92d3cf3 commit d1ab586

1 file changed

Lines changed: 19 additions & 10 deletions

File tree

madcatmailer.py

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
smtp_list_file = 'smtp_list.txt'
2121
mail_list_file = 'mail_list.txt'
2222
mail_body_file = 'mail_body.txt'
23-
attachment_files = 'masterclass_invoice.html'
23+
# attachment_files = 'traffic_log.pcap'
24+
attachment_files = ''
2425
redirects_file = ''
25-
mails_to_verify = 'omgmovebx@outlook.com'
26+
mails_to_verify = 'foxtestbox@outlook.com'
2627
verify_every = 1000
2728
threads_count = 30
2829
connection_timeout = 5
@@ -52,7 +53,7 @@ def worker_item(mail_que, smtp_que, worker_results):
5253
global threads_counter
5354
self = threading.current_thread()
5455
mails_sent = 0
55-
error_regexp = 'could not deliver|per session|timed out|rate-limited|too much|too many|run connect|mailbox unavailable|local error|451'
56+
error_regexp = r'could not deliver|per session|timed out|rate-limited|too much|too many|run connect|mailbox unavailable|local error|451'
5657
while True:
5758
if smtp_que.empty():
5859
break
@@ -71,22 +72,20 @@ def worker_item(mail_que, smtp_que, worker_results):
7172
smtp_sendmail(server_obj,smtp_user,mail_str)
7273
worker_results.put((self.name,f'{smtp_user} sent to {c.GREEN}{c.BOLD}{mail_str}{c.END}',mails_sent))
7374
mails_sent += 1
74-
mail_que.task_done()
7575
except Exception as e:
7676
mail_que.put(mail_str)
7777
e = str(e).strip()
78-
if re.match(error_regexp, e):
78+
if re.search(error_regexp, e):
7979
smtp_que.put(smtp)
80-
# worker_results.put((self.name,f'{c.WARN}{c.BOLD}{e}{c.END}',mails_sent))
8180
worker_results.put((self.name,f'rate-limit error, {smtp_server} {c.WARN}{c.BOLD}added back to queue{c.END}',mails_sent))
8281
else:
8382
worker_results.put((self.name,f'{c.FAIL}{c.BOLD}{e}{c.END}',mails_sent))
8483
time.sleep(1)
8584
break
86-
server_obj.quit()
85+
# server_obj.quit()
8786
except Exception as e:
8887
e = str(e).strip()
89-
if re.match(error_regexp, e):
88+
if re.search(error_regexp, e):
9089
smtp_que.put(smtp)
9190
worker_results.put((self.name,f'timeout error, {smtp_server} {c.WARN}{c.BOLD}added back to queue{c.END}',mails_sent))
9291
else:
@@ -123,6 +122,15 @@ def expand_macros(bytes_data, subs):
123122
bytes_data = bytes_data.replace(macro,random.choice(macro[2:-2].split('|')))
124123
return bytes_data
125124

125+
def get_read_receipt_headers(to):
126+
receipt_headers =f'Disposition-Notification-To: {to}\n'
127+
receipt_headers+=f'Generate-Delivery-Report: {to}\n'
128+
receipt_headers+=f'Read-Receipt-To: {to}\n'
129+
receipt_headers+=f'Return-Receipt-Requested: {to}\n'
130+
receipt_headers+=f'Return-Receipt-To: {to}\n'
131+
receipt_headers+=f'X-Confirm-reading-to: {to}\n'
132+
return receipt_headers
133+
126134
def cut_str(string, length):
127135
return (string, string[0:length-3]+f'...{c.END}')[len(string)>length]
128136

@@ -197,6 +205,7 @@ def smtp_sendmail(server_obj,mail_from,mail_str):
197205
headers+= 'X-Mailer: Microsoft Office Outlook, Build 10.0.5610\n'
198206
headers+= 'X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441\n'
199207
headers+= 'Received: '+random_name+'\n'
208+
headers+= get_read_receipt_headers(mail_from)
200209
message_raw = headers + message.as_string()
201210

202211
server_obj.sendmail(mail_from, mail_to, message_raw)
@@ -216,7 +225,7 @@ def show_banner():
216225
/ Y \\/ A_ \\_/ /_/ | \\ \\_____/ A_ \\| |
217226
\\____A____(______/\\_____| \\_______(______/__|
218227
219-
{c.BOLD}MadCat Mailer v2.2{c.END}
228+
{c.BOLD}MadCat Mailer v2.4{c.END}
220229
Verification emails: {c.BOLD}{mails_to_verify}{c.END}
221230
If you face any problems or have questions feel free to ask me.
222231
Telegram: {c.GREEN}{c.BOLD}@freebug{c.END}\n"""
@@ -227,7 +236,7 @@ def show_banner():
227236
time.sleep(3)
228237

229238
def read_files():
230-
global mail_list,smtp_list,mail_list_file,smtp_list_file,mail_body_file,attachment_file
239+
global mail_list,smtp_list,mail_list_file,smtp_list_file,mail_body_file,attachment_files
231240
try:
232241
mail_list = open(mail_list_file,'r').read().splitlines()
233242
except:

0 commit comments

Comments
 (0)