An automated Python script that leverages the Chrome DevTools Protocol (CDP) to extract cookies from popular web browsers (Chrome, Brave, and Edge) by running them in headless debugging mode. This method effectively bypasses modern security measures like v20/v10 App-Bound Encryption by allowing the browser's own internals to handle the decryption.
- Multi-Browser Support: Works with Google Chrome, Brave, and Microsoft Edge.
- Stealthy Execution: Runs the target browser in
--headlessmode. - Encryption Bypass: Bypasses v20/v10 App-Bound Encryption by interacting directly with the CDP.
- Automated Cleanup: Kills existing browser instances to release database locks and cleans up after extraction.
- JSON Output: Saves extracted cookies in a portable JSON format.
- Local Execution: This tool is designed to be run on the target machine. It interacts with the browser's local user data and spawns a debugging instance on
localhost. - Chromium-Only: Works exclusively with Chrome, Brave, and Edge.
- Operating System: Supports Windows due to hardcoded file paths and process management.
- Windows OS: Paths are hardcoded for default Windows installations.
- Python 3.x: Ensure Python is installed and added to your PATH.
- Required Python packages:
pip install websocket-client requests
Run the script using Python. You can specify the target browser and a custom debugging port.
python get_cookies.pypython get_cookies.py --browser brave
# or
python get_cookies.py -b edgepython get_cookies.py --port 9333- Force Kill: Terminates any running instances of the target browser to ensure the
User Datadirectory is not locked. - Headless Start: Launches the browser with
--remote-debugging-port,--headless, and the user's actual--user-data-dir. - CDP Connection: Connects to the browser's remote debugging interface via WebSockets.
- Cookie Dump: Issues the
Network.getAllCookiescommand to the browser, which returns all cookies (including encrypted ones) in plaintext. - JSON Export: Formats and saves the data to a file named
{browser}_cookies_{timestamp}.json. - Cleanup: Kills the headless browser instance once the task is complete.
Warning
This tool is for educational and authorized security testing purposes only. Unauthorized access to computer systems or data is illegal and unethical. Use this script only on systems you own or have explicit permission to test.