How to get an encryption key from file
I'm trying to get the encryption key from Google Chrome and I get an error saying:
line 13, in find_crypt
print(encrypt['encryption_key'])
KeyError: 'encryption_key'
The code is:
from genericpath import exists
import win32crypt
import json
import os
def find_crypt(path):
path = path.replace('\Default', '')
for file in os.listdir(path):
if file == 'Local State':
f = open('{0}\\{1}'.format(path, file), 'r', encoding='utf-8')
encrypt = json.load(f)
print(encrypt['encryption_key'])
def find_passwords(path):
for file in os.listdir(path):
if file == 'Login Data':
pass
def main():
local = os.getenv('LocalAppData')
roaming = os.getenv('AppData')
directories = {
'chrome' : local + '\\Google\\Chrome\\User Data\\Default'
}
for name, directory in directories.items():
if not os.path.exists(directory):
continue
else:
find_crypt(directory)
find_passwords(directory)
if __name__ == '__main__':
main()
from Recent Questions - Stack Overflow https://ift.tt/3Ibhe73
https://ift.tt/eA8V8J
Comments
Post a Comment