pycookiecheat icon indicating copy to clipboard operation
pycookiecheat copied to clipboard

UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 0: invalid continuation byte

Open brianjmurrell opened this issue 1 year ago • 5 comments

  • Operating system and version: Fedora 40

  • Python version: 3.12.6

  • pycookiecheat version: __version__ = "v0.7.0"

My Issue

$ pycookiecheat -v -v -v -v -v -v -u https://secure.example.com -b Chrome
{'key_material': '[redacted]', 'iterations': 1, 'cookie_file': PosixPath('~/.config/google-chrome/Default/Cookies')}
Traceback (most recent call last):
  File "/home/brian/.local/bin/pycookiecheat", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/home/brian/.local/lib/python3.12/site-packages/pycookiecheat/__main__.py", line 53, in main
    cookies = chrome_cookies(
              ^^^^^^^^^^^^^^^
  File "/home/brian/.local/lib/python3.12/site-packages/pycookiecheat/chrome.py", line 343, in chrome_cookies
    row["value"] = chrome_decrypt(
                   ^^^^^^^^^^^^^^^
  File "/home/brian/.local/lib/python3.12/site-packages/pycookiecheat/chrome.py", line 91, in chrome_decrypt
    return clean(decrypted)
           ^^^^^^^^^^^^^^^^
  File "/home/brian/.local/lib/python3.12/site-packages/pycookiecheat/chrome.py", line 53, in clean
    return decrypted[:-last].decode("utf8")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xcd in position 0: invalid continuation byte

WHYT

I've looked through various issues describing the error message but not finding anything particularly relevant. I did print the value of config right before https://github.com/n8henrie/pycookiecheat/blob/42941d935ee8ee48b0e7fe9acbe1cce447497baa/src/pycookiecheat/chrome.py#L280

and can see that 'key_material' is the same as the key that seahorse shows me for Chrome Safe Storage.

I'm happy to sprinkle print()s wherever else is needed to gather whatever info is needed.


Please make sure you've taken these steps before submitting a new issue:

  • [x] Include the Python and pycookiecheat version in your issue
  • [x] Ensure you're running a supported version of Python
  • [x] Run pycookiecheat in debug mode if applicable and include relevant output
  • [x] Search the existing (including closed) issues
  • [x] Please use codeblocks for any code, config, program output, etc.

brianjmurrell avatar Sep 17 '24 20:09 brianjmurrell