I’m trying to decode a value stored in Firefox localStorage on Linux Alpine. I know that Firefox stores localStorage data in /config/.mozilla/firefox/*.default-release/storage/default/<website>/ls/data.sqlite
. After extracting the encrypted access_token value using the command sqlite3 data.sqlite "SELECT value FROM data WHERE key = 'access_token';"
, I obtained a string like this:
��eyJhbGcisdiJSUzI1NiIsInRsdIgOiAiSldUIiwia2lkIiA6ICJsdkdsSnR6RjRxXzdrdWhSc29VTUNrM2k1dGVNMU1EMh0dHBzOi8vcHJvY29uLWsdnN1bWlkb3ItcHJvZC5henVyZXdlYnNpdGVzLm5ldCIsImh0dHBzOi8vcHJvY29uLWZvcm5lY2 ��yaG1sLmF6dXJld2Vic2l0ZXMubmV0L2F1dGhlbnRpY2F0aW9uL2xvZ2luLWNhbGxiYWNrIiwiaHR0cHM6Ly9icGNvbnN1bsdkb3JwcmQuY2JseC5kZXYiLCJodHq$.,
It seems that Firefox uses the Snappy algorithm to encrypt this value, as mentioned in /a/77335474/6328506. However, when I copied the extracted value to a file and used the python-snappy library, I received the following error:
>>> snappy.uncompress(file.read())
Traceback (most recent call last):
File "/Users/abc/.pyenv/versions/cde/lib/python3.11/site-packages/snappy/snappy.py", line 84, in uncompress
out = bytes(_uncompress(data))
^^^^^^^^^^^^^^^^^
cramjam.DecompressionError: snappy: input buffer (size = 446315786887151) is larger than allowed (size = 4294967295)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/cde/.pyenv/versions/abc/lib/python3.11/site-packages/snappy/snappy.py", line 86, in uncompress
raise UncompressError from err
snappy.snappy.UncompressError
What should I do to extract the access_token value saved in localStorage in the same format as displayed in the browser?