Read Firefox sqlite files with Python

Steve D'Aprano steve+python at pearwood.info
Sat Nov 4 13:32:13 EDT 2017


I'm trying to dump a Firefox IndexDB sqlite file to text using Python 3.5.


import sqlite3
con = sqlite3.connect('foo.sqlite')
with open('dump.sql', 'w') as f:
    for line in con.iterdump():
        f.write(line + '\n')


The error I get is:

Traceback (most recent call last):
  File "<stdin>", line 2, in <module>
  File "/usr/local/lib/python3.5/sqlite3/dump.py", line 30, in _iterdump
    schema_res = cu.execute(q)
sqlite3.DatabaseError: file is encrypted or is not a database


If I open the file in a hex editor, it starts with:

SQLite format 3

and although I can see a few human readable words, the bulk of the file looks
like noise.




-- 
Steve
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list