Simplify getting and using cookies from the browser to use in Python.

Overview

CookieCache

Simplify getting and using cookies from the browser to use in Python.

NOTE: All the logic to interface with the browsers is done by the Browser Cookie 3 library.

This code wraps that BrowserCookie3 in a CLI and library that caches the selected cookies as JSON to disk, so they can be transferred to other machines, or be used again without having to interactivly re-enter MacOS user credentials.

Install

pip install cookiecache

Usage

The idea is you run cookiecache once (either as a cli tool or as a library), and then cache the cookies to JSON on disk. Then the next time you run the same thing, cookiecache will look in the JSON file first, and only get fresh cookies from the browser if they have expired.

CLI

Examples:

# Get github session cookies and save to disk
cookiecache --domain "github.com" --cookie "_gh_sess" --filename "cookies.json"

# Get all github cookies in Netscape/Mozilla format to use with curl, et.c:
cookiecache --domain "github.com" --filename "cookies.txt" --curl

# All options:
cookiecache --help

Library

To use cookiecache as a library call load() with arguments similar to the cli:

import cookiecache

# Get github session cookies and save to disk
# After the first run this will load the cookies
# from disk first, and only get them from the brower
# if they have expired
cookies = cookiecache.load(
    domain="github.com",
    cookie="_gh_sess",
    filename="cookies.json",
)

# Load all cookies from JSON file from another machine, ie.
# Don't attempt to refresh or get cookies from this machine
cookies = cookiecache.load(
    filename="cookies.json",
    check_expiry=False
)

# Get cookies only from Chrome, and don't read or save to disk
cookies = cookiecache.load(
    domain="github.com",
    browser="chrome",
)

# Convert cookies from cookiecache to a flat key-value
# pair to use with Requests
cookies = cookiecache.load(domain="github.com")
cookies_flat = cookiecache.flatten_cookies(cookies)
reqeusts.get("http://github.com", cookies=cookies_flat)
You might also like...
A toolkit for web reconnaissance, it's fast and easy to use.
A toolkit for web reconnaissance, it's fast and easy to use.

A toolkit for web reconnaissance, it's fast and easy to use. File Structure httpsuite/ main.py init.py db/ db.py init.py subdomains_db directories_db

A wordlist generator tool, that allows you to supply a set of words, giving you the possibility to craft multiple variations from the given words, creating a unique and ideal wordlist to use regarding a specific target.
A wordlist generator tool, that allows you to supply a set of words, giving you the possibility to craft multiple variations from the given words, creating a unique and ideal wordlist to use regarding a specific target.

A wordlist generator tool, that allows you to supply a set of words, giving you the possibility to craft multiple variations from the given words, creating a unique and ideal wordlist to use regarding a specific target.

Automatically fetch, measure, and merge subscription links on the network, use Github Action

Free Node Merge Introduction Modified from alanbobs999/TopFreeProxies It measures the speed of free nodes on the network and import the stable and hig

Format SSSD Raw Kerberos Payloads into CCACHE files for use on Windows systems
Format SSSD Raw Kerberos Payloads into CCACHE files for use on Windows systems

KCMTicketFormatter This tools takes the output from https://github.com/fireeye/SSSDKCMExtractor and turns it into properly formatted CCACHE files for

Use FOFA automatic vulnerability scanning tool
Use FOFA automatic vulnerability scanning tool

AutoSRC Use FOFA automatic vulnerability scanning tool Usage python3 autosrc.py -e FOFA EMAIL -k TOKEN Screenshots License MIT Dev 6613GitHub6613

Description Basic Recon tool for beginners. Especially those who faces issue on how to recon or what all tools to use

Description Basic Recon tool for beginners. Especially those who faces issue on how to recon or what all tools to use. Will try to add atleast 10 more tools currently use 7 sources to gather domains.Currenlty uses below mentioned tools and also sort live domains using HttpX.

Lite version of my Gatekeeper backdoor for public use.
Lite version of my Gatekeeper backdoor for public use.

MayorSec Backdoor Fully functioning bind-type backdoor This backdoor is a fully functioning bind shell and lite version of my full functioning Gatekee

How to exploit a double free vulnerability in 2021. 'Use-After-Free for Dummies'
How to exploit a double free vulnerability in 2021. 'Use-After-Free for Dummies'

This bug doesn’t exist on x86: Exploiting an ARM-only race condition How to exploit a double free and get a shell. "Use-After-Free for dummies" In thi

Proof of concept for CVE-2021-31166, a remote HTTP.sys use-after-free triggered remotely.
Proof of concept for CVE-2021-31166, a remote HTTP.sys use-after-free triggered remotely.

CVE-2021-31166: HTTP Protocol Stack Remote Code Execution Vulnerability This is a proof of concept for CVE-2021-31166 ("HTTP Protocol Stack Remote Cod

Owner
pat_h/to/file
pat_h/to/file
LeLeLe: A tool to simplify the application of Lattice attacks.

LeLeLe is a very simple library (<300 lines) to help you more easily implement lattice attacks, the library is inspired by Z3Py (python interfa

Mathias Hall-Andersen 4 Dec 14, 2021
NS-LOOKUP - A python script for scanning website for getting ip address of a website

NS-LOOKUP A python script for scanning website for getting ip address of a websi

Spider Anongreyhat 5 Aug 2, 2022
Getting my gitlab commit history into github

This is a mock repository. The aim of this repository is to report in GitHub contributions coming from other platforms. It has been automatically crea

Santiago Chiesa 1 Dec 24, 2021
Vulnerability Scanner & Auto Exploiter You can use this tool to check the security by finding the vulnerability in your website or you can use this tool to Get Shells

About create a target list or select one target, scans then exploits, done! Vulnnr is a Vulnerability Scanner & Auto Exploiter You can use this tool t

Nano 108 Dec 4, 2021
Mad Spammer is a python webhook spammer which is very easy and safe to use.

Mad Spammer ?? Pre-Setup: Open your terminal/console and type: pip install module colorama python MadSpammer.py Setup: After doing that, you should be

null 1 Nov 26, 2021
This is a partial and quick and dirty proof of concept implementation of the following specifications to configure a tor client to use trusted exit relays only.

This is a partial and quick and dirty proof of concept implementation of the following specifications to configure a tor client to use trusted exit re

null 22 Nov 9, 2022
labsecurity is a framework and its use is for ethical hacking and computer security

labsecurity labsecurity is a framework and its use is for ethical hacking and computer security. Warning This tool is only for educational purpose. If

Dylan Meca 16 Dec 8, 2022
Experimental musig2 python code, not for production use!

musig2-py Experimental musig2 python code, not for production use! This is just for testing things out. All public keys are encoded as 32 bytes, assum

Samuel Dobson 14 Jul 8, 2022
the swiss army knife in the hash field. fast, reliable and easy to use

hexxus Hexxus is a fast hash cracking tool which checks more than 30 thousand passwords in under 4 seconds and can crack the following types bcrypt sh

enigma146 17 Apr 5, 2022
The Devils Eye is an OSINT tool that searches the Darkweb for onion links and descriptions that match with the users query without requiring the use for Tor.

The Devil's Eye searches the darkweb for information relating to the user's query and returns the results including .onion links and their description

Richard Mwewa 135 Dec 31, 2022