Hey there! I know it might look like a silly question, but to decrypt Chrome's cookies, it needs to do it from the User's machine right? What if, lets say, there's a malware that steals cookies, can it also decrypt it too with this kind of method?
@jaxe233 interesting question, especially when it comes from a user that just registered an account and added as a profile picture a South Korean singer.
How would I edit this to work with other things like the History? Especially the last cursor.execute(), I don't really know SQL so I don't understand.
Hey There @gram Thanos. I only see the cookies file being copied to directory where the python script is located. Is there an output directory I should be looking for?
@gitHubMaster555 this functionality was there before my fork. The cookies file is copied to the current working directory (CWD) which may not be the folder where your script is located (it depends on how you call the script).
Hey There @GramThanos . I found some error and this script cannot running on my pc.
First I run it script it print this error:
Traceback (most recent call last): File "C:\Users\ANT\AppData\Local\123456\de.py", line 25, in <module> encrypted_key = json.loads(file.read())['os_crypt']['encrypted_key'] UnicodeDecodeError: 'gbk' codec can't decode byte 0xaa in position 23571: illegal multibyte sequence
When I transcoding "Local State" UTF-8 to gbk.
Traceback (most recent call last): File "C:\Users\ANT\AppData\Local\123456\de.py", line 28, in <module> decrypted_key = win32crypt.CryptUnprotectData(encrypted_key, None, None, None, 0)[1] pywintypes.error: (-2146893813, 'CryptProtectData', 'Key not valid for use in specified state.')
How to fix it ?
@AnateXP check the file's os.getenv("APPDATA") + "/../Local/Google/Chrome/User Data/Local State"
contents. Something is not right there. This has to do with your chrome I guess.
Can you help me about this error? "sqlite3.OperationalError: Could not decode to UTF-8 column 'encrypted_value' with text 'v10�V�
Can you help me about this error? "sqlite3.OperationalError: Could not decode to UTF-8 column 'encrypted_value' with text 'v10�V�
♦ ☺ h�#��P��*�-4�n�§���g��'"
There are many results on Google with discussions on this error.
Can you help me about this error? "sqlite3.OperationalError: Could not decode to UTF-8 column 'encrypted_value' with text 'v10�V�
♦ ☺ h�#��P��*�-4�n�§���g��'"There are many results on Google with discussions on this error.
I am also got this error, sqlite3.OperationalError: Could not decode to UTF-8 column 'encrypted_value' with text 'v10��~��|�d:.3�,:X��&���lr2���Kk���e�%U��l'
OS: Windows 10 x64 20H2
Python: 3.9.2
Google and try add conn.text_factory = bytes
or conn.text_factory = str
can not resolve it.
Can you help me about this error? "sqlite3.OperationalError: Could not decode to UTF-8 column 'encrypted_value' with text 'v10�V�
♦ ☺ h�#��P��*�-4�n�§���g��'"There are many results on Google with discussions on this error.
I am also got this error,
sqlite3.OperationalError: Could not decode to UTF-8 column 'encrypted_value' with text 'v10��~��|�d:.3�,:X��&���lr2���Kk���e�%U��l'
OS: Windows 10 x64 20H2
Python: 3.9.2
Google and try addconn.text_factory = bytes
orconn.text_factory = str
can not resolve it.
conn.text_factory = bytes
helped me to resolved the issue. Thanks a lot!
Thank you for this good work. I had a need to change the encrypted cookie value. Please tell me how to encrypt the new value?
I tried to do something, but it didn't work out.
code
def get_encryption_value(key, data):
iv = b'v10' + Random.get_random_bytes(12)
cipher = AES.new(key, AES.MODE_GCM, iv)
data = bytes(data, "utf-8")
encryption_value = iv + cipher.encrypt(data)
print(encryption_value)
I haven't tried anything similar.
我没有尝试过类似的东西。
password = win32crypt.CryptUnprotectData(result[2])[1].decode()
error: (13, 'CryptProtectData', '数据无效。')
我更新了代码以使用新的 chrome 加密系统
I'm getting FileNotFoundError
on the copyfile
line, looks like Chrome moved their cookies file into a Network
subfolder. Fixed by replacing line 20 with this
fpath = os.path.join(os.getenv("USERPROFILE"), "AppData/Local/Google/Chrome/User Data/Default/Network/Cookies")
copyfile(fpath, './Cookies')
Please note that these kind of things change once in a while.
Code updated to support new encryption method.
A more advance version/tool can be found here