unjar ๐ช
unjar reads cookies from local browser profiles and exports them as a cookies.txt file, JSON, or a Cookie: header. Use it as a CLI or Rust library.
Installation
Install using Cargo:
CLI
Show discovered browser profiles:
Show help without reading any cookies:
Dump cookies for one or more domains using Chrome by default:
Explicitly dump every cookie from the selected browser or profile:
Select a profile by ID, unique display name, or path:
Write cookies to a file and use it with curl or yt-dlp:
unjar list prints each discovered profile's browser, local profile ID, default selection, and path. A unique ID or display name works without --browser; use --browser to disambiguate duplicates. An explicit path may point to a profile directory or directly to its cookie database. For a copied or otherwise unknown path, also pass --browser so unjar can select the right decryption backend.
The header format accepts exactly one host. It includes every cookie whose stored domain matches that host; it does not evaluate URL path, scheme, expiration, or other request attributes. Use JSON or Netscape format when exporting multiple domains or all.
Library
use Browser;
Recipes
curl
Pipe your browser cookies into the GitLab API to show the user logged into your browser:
|
The GitLab API accepts the browser session cookie and returns the current user as JSON. The -b - argument tells curl to read the Netscape cookie file from stdin.
twscrape
twscrape accepts a cookie header from stdin. Log into X in your browser, then pipe the cookies straight into a local account:
|
my_account is a local identifier in twscrape; it does not need to match the X username stored in the cookies.
When the selected profile is logged into X, unjar x.com includes the auth_token and ct0 cookies that twscrape needs, plus the rest of the matching session cookies.
Supported browsers
Legend: โ tested ยท ๐ก implemented, not yet tested ยท ๐ง not implemented.
| Browser | macOS | Linux | Windows |
|---|---|---|---|
| Chrome | โ | ๐ก | ๐ง |
| Chromium | ๐ก | ๐ก | ๐ง |
| Edge | โ | ๐ก | ๐ง |
| Brave | ๐ก | ๐ก | ๐ง |
| Firefox | โ | ๐ก | ๐ก |
| Safari | โ | โ | โ |
Chrome, Edge, Firefox, and Safari on macOS have been verified end-to-end, including Safari's named profiles. Linux Chromium decryption currently relies on the peanuts fallback and will not decrypt profiles that store the key in the system keyring (v11). Windows support is not implemented yet.
Current Chromium-based browsers on Windows protect cookies with App-Bound Encryption, which only the browser itself can decrypt. Supporting current Chrome, Edge, or Brave therefore requires an explicit browser integration such as a user-installed extension; unjar does not attempt to bypass this protection through elevation or process injection.
Contributing
All contributions are welcome! Feel free to open an issue or submit a pull request.
License
Distributed under the MIT License.