thewh1teagle / rookie

Load cookies from your web browsers
https://crates.io/crates/rookie
MIT License
204 stars 18 forks source link

[Bug]: chromium_based with custom path throws "decrypt_encrypted_value failed" #86

Open buruss opened 1 week ago

buruss commented 1 week ago

What happened?

throws "decrypt_encrypted_value failed" error only when passing custom path to chromium_based().

import rookiepy db_path = "D:\temp\cookie2\Default\Network\Cookies" key_path = "D:\temp\cookie2\Local State" cookies = rookiepy.chromium_based( db_path=str(db_path), key_path=str(key_path), domains=None ) print(cookies)

it works if I change the db_path and key_path to chrome's original profile path. ex) db_path = "C:\Users\user1\AppData\Local\Google\Chrome\User Data\Default\Network\Cookies" key_path = "C:\Users\user1\AppData\Local\Google\Chrome\User Data\Local State"

Steps to reproduce

  1. Windows 10 64bit
  2. Chrome 130.0.6723.117
  3. create cookie at custom path by running chrome.exe --user-data-dir="D:\temp\cookie2"
  4. close chrome and run above code as administrator.

What browsers are you seeing the problem on?

Chrome

Relevant log output

DEBUG:rookie.browser.chromium:Admin rights detected
INFO:rookie.windows.shadow_copy:Creating shadow copy to cookies file from D:\temp\cookie2\Default\Network\Cookies to C:\Users\user1\AppData\Local\Temp\.tmpOOHwOj8Xin
DEBUG:rawcopy_rs_next:Saving 20480 bytes of data in "Cookies"...
DEBUG:rawcopy_rs_next:Done! save to C:\Users\user1\AppData\Local\Temp\.tmpOOHwOj8Xin\Cookies
DEBUG:rookie.browser.chromium:shadow copy result: Ok(())
INFO:rookie.browser.chromium:Creating SQLite connection to C:\Users\user1\AppData\Local\Temp\.tmpOOHwOj8Xin\Cookies
DEBUG:rookie.browser.chromium:key type: [118, 49, 48]
WARNING:rookie.browser.chromium:Failed to decode plaintext: Can't decode encrypted value
Traceback (most recent call last):
  File "C:\test\test.py", line 4, in <module>
    cookies = rookiepy.chromium_based(
              ^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: decrypt_encrypted_value failed

Location:
    rookie-rs\src\browser\chromium.rs:201:3