Skip to main content

Python Binary Cookies (de)serializer

Project description

Github Actions Status

Binary Cookies

CLI tool and Python library for reading and writing Binary Cookies.

Documentation

For detailed documentation, please visit the Binary Cookies Documentation

Requirements

  • Python >= 3.9

Installation

pip install binarycookies

CLI example:

bcparser path/to/cookies.binarycookies

Output:

[
  {
    "name": "session_id",
    "value": "abc123",
    "url": "https://example.com",
    "path": "/",
    "create_datetime": "2023-10-01T12:34:56+00:00",
    "expiry_datetime": "2023-12-31T23:59:59+00:00",
    "flag": "Secure"
  },
  {
    "name": "user_token",
    "value": "xyz789",
    "url": "https://example.com",
    "path": "/account",
    "create_datetime": "2023-10-01T12:34:56+00:00",
    "expiry_datetime": "2023-12-31T23:59:59+00:00",
    "flag": "HttpOnly"
  }
]

Output formats

The CLI supports multiple output formats using the --output flag.

  • json (default): Outputs cookies in JSON format.
  • ascii: Outputs cookies in a human-readable ASCII format with each cookie property on a separate line.
  • netscape: Outputs cookies in the Netscape cookie file format.

Basic Usage Python

Deserialization

import binarycookies 

with open("path/to/cookies.binarycookies", "rb") as f:
    cookies = binarycookies.load(f)

Serialization

import binarycookies 

cookie = {
    "name": "session_id",
    "value": "abc123",
    "url": "https://example.com",
    "path": "/",
    "create_datetime": "2023-10-01T12:34:56+00:00",
    "expiry_datetime": "2023-12-31T23:59:59+00:00",
    "flag": "Secure"
}

with open("path/to/cookies.binarycookies", "wb") as f:
    binarycookies.dump(cookie, f)

Ethical Use & Responsible Handling

This project is intended for lawful, ethical use only. Typical, appropriate uses include:

  • Inspecting Binary Cookies from your own devices or data you are authorized to access
  • DFIR, QA, and security testing performed with explicit, written permission
  • Educational/research work on datasets that are owned by you, anonymized, or publicly released for that purpose

You must not use this tool to:

  • Access, extract, modify, or distribute cookies from systems or accounts you do not own or have permission to analyze
  • Bypass authentication, session management, DRM, or other technical controls
  • Enable tracking, stalking, doxxing, fraud, or other privacy-invasive or harmful activities

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contributing

Contributions are welcome! If you find a bug or have a feature request, please open an issue on GitHub. Pull requests are also welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

binarycookies-2.3.0.tar.gz (11.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

binarycookies-2.3.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file binarycookies-2.3.0.tar.gz.

File metadata

  • Download URL: binarycookies-2.3.0.tar.gz
  • Upload date:
  • Size: 11.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binarycookies-2.3.0.tar.gz
Algorithm Hash digest
SHA256 f5885dfb3284ab3ae9433db270f2d365c5fa97c510f1fc67ba689c4e6816c043
MD5 9335acb22fa3e10a43378bfc8fa395b2
BLAKE2b-256 e62b30ffad68f01a33b33a097023122663d35313b8d2f5113d6758d3015b61a3

See more details on using hashes here.

Provenance

The following attestation bundles were made for binarycookies-2.3.0.tar.gz:

Publisher: build-and-publish.yml on dan1elt0m/binarycookies

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file binarycookies-2.3.0-py3-none-any.whl.

File metadata

  • Download URL: binarycookies-2.3.0-py3-none-any.whl
  • Upload date:
  • Size: 11.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for binarycookies-2.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5db6ed10dd034166f0b6a9c3d32aaa0cb3ebf4f4e3e1d4a0fb5faa83d67a5b02
MD5 74a508332ca8dc19a5704c8153e02720
BLAKE2b-256 91e87fd7aec0c219665ef06ba7242969aeb41b3b0bd93ea7467bbec059e1cb79

See more details on using hashes here.

Provenance

The following attestation bundles were made for binarycookies-2.3.0-py3-none-any.whl:

Publisher: build-and-publish.yml on dan1elt0m/binarycookies

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page