Instantly share code, notes, and snippets.

What would you like to do?
IndexedDB database file walker for Firefox
#!/usr/bin/env python3.6
Hacky code to walk all the IndexedDB storage in your Firefox profile
and print some basic information about them.
The hardcoded path here works in WSL, Linux-for-Windows. Change as needed.
base_dir = '/mnt/c/Users/*/AppData/Roaming/Mozilla/Firefox/Profiles/*/storage/default/'
import sqlite3, glob, re
path_re = re.compile(r'storage/default/([^/]+)/idb/')
q_db_cols = '''
select, group_concat(
from object_store left join object_store_index
on = object_store_index.object_store_id
group by;
q_dbs = '''
select origin, name, version, last_vacuum_size
from database;
for fn in glob.glob(f'{base_dir}/*/idb/*.sqlite'):
# Grab the site from the path name, but we don't really use this
m =
assert m is not None
site_path ='+++', '://')
conn = sqlite3.connect(fn)
c = conn.cursor()
for origin, name, version, size in c.execute(q_dbs):
print(f'{origin:30.30} {name:24.24} {version:10} {size:10}')
for table, columns in conn.execute(q_db_cols):
columns = '-' if columns is None else columns
columns = columns.replace(',', ', ')
print(f' {table} {columns}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment