Read Firefox sqlite files with Python

Rustom Mody rustompmody at gmail.com
Mon Nov 6 08:24:53 EST 2017


On Monday, November 6, 2017 at 8:42:29 AM UTC+5:30, Steve D'Aprano wrote:
> On Mon, 6 Nov 2017 12:39 am, Paul Moore wrote:
> 
> > On 5 November 2017 at 01:22, Steve D'Aprano wrote:
> >> On Sun, 5 Nov 2017 04:32 am, 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')
> >>
> >>
> >> Never mind. I dumped the file using the sqlite3 command line tool. Thank
> >> you to all those who answered.
> >>
> >> The file contains three INSERT statements, the first two don't have
> >> anything of interest, and the third (which presumably contains all the data
> >> I'm trying to recover) is an opaque 600+ KB blob.
> >>
> >> Naturally. Why would you use a database as a database, when instead you
> >> could just dump a big ball of mud into it?
> > 
> > Hmm, *.sql files normally contain SQL source code (as this one does).
> 
> The .sql file is the result of running .dump from the sqlite command line
> tool. The original source database is 'foo.sqlite'. To be precise, it is the
> database used by the Firefox Add-On "One Tab".
> 
> /home/steve/.mozilla/firefox/2z5po7dx.default/storage/permanent/indexeddb+++extension-at-one-tab-dot-com/idb/1832832054obnaet.sqlite
> 
> One Tab provides an alternative bookmark-like function, allowing you to record
> URLs in groups for later use -- a bit like bookmarks. So I've been using this
> for some months, until the add-on stopped working. (Yet again an automatic
> update has screwed me and broken functionality.) So now I'm trying to
> retrieve the bookmarks.

[Not python-related and likely not an answer… Just what I would try]

1. Get hold of an old live ubuntu (say 12.4) ISO/flash/CD and boot
2. Mount /home
3. Make livecd~/.mozilla symlink to home/~steven/.mozilla

Do you see your bookmarks?



More information about the Python-list mailing list