Skip to content

SyntX34/CookieMonster

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸͺ CookieMonster

Cross-platform browser cookie extractor for yt-dlp β€” Windows, macOS, Linux. Created by SyntX.

Windows MSVC Windows MinGW macOS Linux License: MIT


Features

  • Multi-browser support β€” Chrome, Edge, Brave, Firefox
  • Site filtering β€” Extract cookies for a specific domain with --site youtube.com
  • Smart polling mode β€” Automatically polls the cookie database for ~36 seconds to capture cookies that appear over time (page loads, redirects, JS execution)
  • Lock-bypass technology β€” Copies the locked SQLite database to a temporary location before reading, with URI immutable=1 fallback β€” no need to close your browser!
  • Process detection β€” Detects running browsers and gives helpful diagnostic messages
  • Dual output β€” Netscape cookies.txt (for yt-dlp --cookies) and JSON (yt-dlp --cookies-json)
  • Cross-platform β€” Windows (MSVC + MinGW), macOS, Linux

Quick Start

# Extract ALL cookies from Chrome
CookieMonster --chrome --txt -o cookies.txt

# Extract cookies for a specific domain (with ~36s polling)
CookieMonster --chrome --site youtube.com --txt -o cookies.txt

# Shorthand β€” bare domain syntax
CookieMonster --chrome --youtube.com --txt -o cookies.txt

# Firefox with JSON output
CookieMonster -b firefox --json -o cookies.json

# Check which browsers are detected
CookieMonster --list-browsers

Usage

Browser selection

Flag Browser Windows macOS Linux
--chrome / -c Google Chrome βœ… ⏳ ⏳
--edge / -e Microsoft Edge βœ… ⏳ ⏳
--brave Brave βœ… ⏳ ⏳
--firefox / -f Firefox βœ… βœ… βœ…
-b <name> Any above

βœ… = fully working | ⏳ = Firefox-only (Chrome stub, needs platform keychain integration)

Site filtering (new!)

# Using --site flag
CookieMonster --chrome --site youtube.com --txt -o cookies.txt

# Using --domain alias
CookieMonster --chrome --domain youtube.com --txt -o cookies.txt

# Shorthand with bare --domain.com
CookieMonster --chrome --youtube.com --txt -o cookies.txt

When --site is provided, polling mode activates automatically:

  • Polls the cookie database every 3 seconds for ~36 seconds
  • Detects and collects new cookies as they appear
  • Deduplicates across polls (no duplicates in output)
  • Shows live progress: Poll 3/12 β€” 143 read, +5 new (total: 89)
  • Filters output to only include cookies matching the specified domain

Output formats

  • --txt β†’ Netscape HTTP Cookie File (yt-dlp --cookies cookies.txt)
  • --json β†’ JSON array (yt-dlp --cookies-json cookies.json)

Diagnostics

If something goes wrong, the error messages now include:

  • The full file path to the cookie database
  • The SQLite error code (e.g. SQLITE_CANTOPEN)
  • A list of running browsers that might be interfering
  • Specific guidance on how to resolve the issue

How it works

Chrome cookie database access

Chrome holds an exclusive lock on its SQLite Cookies database while running, which normally prevents other tools from reading it. CookieMonster bypasses this with a two-tier strategy:

  1. Copy to temp β€” Copies the locked database file to %TEMP%, then opens the copy (Windows allows copying locked files)
  2. URI immutable mode β€” If the copy also fails (rare), falls back to SQLite's ?mode=ro&immutable=1 URI which skips all file locking entirely

This means you can keep Chrome open while extracting cookies β€” no more "Failed to open cookie database" errors.

The same technique is applied to Firefox's cookies.sqlite.

Key decryption (Chromium)

Chromium browsers (Chrome, Edge, Brave):

  1. Reads the encrypted AES-256 key from Local State JSON
  2. Platform-specific key unwrap:
    • Windows: DPAPI (CryptUnprotectData)
    • macOS: Keychain (coming)
    • Linux: libsecret (coming)
  3. Opens the Cookies SQLite database
  4. Decrypts each cookie with AES-256-GCM
  5. Writes to output file

Firefox:

  1. Finds the default profile's cookies.sqlite
  2. Reads cookies directly (plaintext)

Building from source

Dependencies

Component Windows macOS Linux
SQLite3 Bundled Bundled Bundled
nlohmann/json Bundled Bundled Bundled
AES-GCM BCrypt (built-in) OpenSSL (brew install openssl) OpenSSL (libssl-dev)
DPAPI Built-in β€” β€”

Windows (MSVC)

cmake -P cmake/DownloadDeps.cmake
cmake -B build -S .
cmake --build build --config Release

Statically links the CRT β€” no VC++ redistributable needed.

Windows (MinGW-w64)

cmake -P cmake/DownloadDeps.cmake
cmake -B build -S . -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release
cmake --build build

macOS

brew install openssl
cmake -P cmake/DownloadDeps.cmake
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build

Linux (Ubuntu/Debian)

sudo apt install libssl-dev
cmake -P cmake/DownloadDeps.cmake
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
cmake --build build

SSL issues with CMake

On systems where SSL certificate verification fails during dependency download, set:

cmake -P cmake/DownloadDeps.cmake -DCMAKE_TLS_VERIFY=0

CI / Release

Trigger a release build manually from the Actions tab:

workflow_dispatch β†’ enter version tag (e.g. v1.1.0)

This builds all four platforms and creates a GitHub Release with the zipped binaries attached.


License

Copyright (c) 2026 SyntX. All rights reserved.

Licensed under the MIT License.

About

No description, website, or topics provided.

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors