Giter Site home page Giter Site logo

cookiemonster's Introduction

alt text

CookieMonster

CookieMonster is a tool designed to discover and categorize cookies set by websites. It utilizes a headless Chrome browser to visit a given URL (or URLs from a file), extract cookies, categorize them into first-party, third-party, and third-party tracking cookies, and then optionally generates a summary report.

Installation

Ensure that you have Python 3 installed. You'll also need to install the necessary Python packages listed in the requirements.txt file. You can install them using pip:

pip install -r requirements.txt

Headless Chrome Setup

To run Chrome in headless mode, you need to have Google Chrome and chromedriver installed on your system. Here's how you can set them up on Ubuntu:

  1. Install Google Chrome:

    wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
    sudo apt install ./google-chrome-stable_current_amd64.deb
  2. Install chromedriver: webdriver-manager will automatically download the correct version of chromedriver when you run the script, so no additional installation steps are needed.

  3. Install Xvfb (to simulate a display environment):

    sudo apt-get install -y xvfb

Usage

python3 CookieMonster.py [URL or file] [options]

Arguments

  • URL or file: The URL of the website to analyze or a file containing a list of URLs to analyze.

Options

  • -s, --screenshot: Take a screenshot of the website.
  • -r, --report: Generate a summary report of tracking patterns.
  • -v, --verbose: Enable verbose mode for debugging (shows browser console logs and internal variables).
  • -f, --file: Indicates that the input is a file containing a list of URLs.

Examples

  1. Analyze a single URL and take a screenshot:

    python3 CookieMonster.py https://www.example.com -s
  2. Analyze a list of URLs from a file and generate a summary report:

    python3 CookieMonster.py urls.txt -f -r
  3. Analyze a single URL with verbose mode enabled:

    python3 CookieMonster.py https://www.example.com -v
  4. Analyze a file of URLs with both verbose mode and a summary report:

    python3 CookieMonster.py urls.txt -f -v -r

Tracking Cookie Patterns

The script uses a tracking_cookie_patterns.json file to identify and categorize tracking cookies. This file contains patterns of known tracking cookies along with their friendly names and descriptions. You can customize this file to add or update patterns as needed.

Example tracking_cookie_patterns.json Structure:

{
    "Google Analytics": {
        "description": "Google Analytics is a web analytics service offered by Google that tracks and reports website traffic.",
        "patterns": [
            ["_ga", "Google Analytics", "Used to distinguish users."],
            ["_gid", "Google Analytics", "Used to distinguish users."]
        ]
    },
    ...
}

Output

The script will print categorized cookies to the console, and if the -r option is used, it will generate a summary report sorted by the most common tracking patterns. The output is also saved to a CSV file named cookie_report.csv.

If the -s option is used, a screenshot of the visited website is saved as screenshot.png.

License

This project is licensed under the MIT License.

cookiemonster's People

Contributors

njoyzrd avatar shellntel-acct avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.