Extract cookies.txt from firefox profiles
Find a file
2026-10-25 21:52:11 +01:00
.gitignore ignoring cookies.txt 2026-10-25 21:52:11 +01:00
extract_cookies.py feat: add domain number selection to extract all cookies from a domain 2026-10-25 21:51:17 +01:00
pyproject.toml chore: switch to uv for running scripts and add pyproject.toml 2026-10-25 21:30:27 +01:00
README.md chore: switch to uv for running scripts and add pyproject.toml 2026-10-25 21:30:27 +01:00

Firefox Cookie Extractor

Extract cookies from a Firefox profile and save them to a Netscape-format cookie file (cookies.txt).

Requirements

  • Python 3.8+
  • uv (install with curl -LsSf https://astral.sh/uv/install.sh | sh)
  • A Firefox profile directory containing cookies.sqlite

Usage

uv run extract_cookies.py --mozilla-dir /path/to/.mozilla

If --mozilla-dir is omitted it defaults to .mozilla in the current working directory.

Steps

  1. The script lists all profiles that contain a cookies.sqlite file.
  2. Pick a profile by number.
  3. All cookies are displayed grouped by website.
  4. Enter cookie numbers (comma-separated), a range (e.g. 1-5), or type all to select everything.
  5. Selected cookies are written to cookies.txt in the current directory.

Notes

  • Close Firefox before running to avoid file-lock issues (the script copies the DB to a temp file, but a locked source file may still cause problems on some platforms).
  • The output file uses the Netscape cookie format compatible with curl -b cookies.txt.