Read Firefox sqlite files with Python

Peter Otten __peter__ at web.de
Sat Nov 4 14:48:54 EDT 2017


Steve D'Aprano wrote:

> 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.

I've seen that error message before:

https://mail.python.org/pipermail/tutor/2013-July/097022.html




More information about the Python-list mailing list