def chrome_process(safe_storage_key, loginData):
iv = ''.join(('20',) * 16) #salt, iterations, iv, size - https://cs.chromium.org/chromium/src/components/os_crypt/os_crypt_mac.mm
key = hashlib.pbkdf2_hmac('sha1', safe_storage_key, b'saltysalt', 1003)[:16]
copypath = tempfile.mkdtemp() #work around for locking DB
dbcopy = protected_file_reader(loginData) #again, shouldnt matter because we only can decrypt DBs with keys
with open('%s/chrome' % copypath, 'wb') as content:
content.write(dbcopy) #if chrome is open, the DB will be locked, so get around by making a temp copy
database = sqlite3.connect('%s/chrome' % copypath)
sql = 'select username_value, password_value, origin_url from logins'
decryptedList = []
with database:
for user, encryptedPass, url in database.execute(sql):
if user == "" or (encryptedPass[:3] != b'v10'): #user will be empty if they have selected "never" store password
continue
else:
urlUserPassDecrypted = (url.encode('ascii', 'ignore'), user.encode('ascii', 'ignore'), chrome_decrypt(encryptedPass, iv, key=key).encode('ascii', 'ignore'))
decryptedList.append(urlUserPassDecrypted)
shutil.rmtree(copypath)
return decryptedList
评论列表
文章目录