Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/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 object_store.name, group_concat(object_store_index.name)
- from object_store left join object_store_index
- on object_store.id = object_store_index.object_store_id
- group by object_store.name;
- '''
- 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 = path_re.search(fn)
- assert m is not None
- site_path = m.group(1).replace('+++', '://')
- 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}')
- print()
Add Comment
Please, Sign In to add comment