Extract cookies.txt from firefox profiles
- Python 100%
| .gitignore | ||
| extract_cookies.py | ||
| pyproject.toml | ||
| README.md | ||
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
- The script lists all profiles that contain a cookies.sqlite file.
- Pick a profile by number.
- All cookies are displayed grouped by website.
- Enter cookie numbers (comma-separated), a range (e.g. 1-5), or type all to select everything.
- 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.