Skip to main content

Python decorator for parallel exploit dispatch in Attack & Defense CTFs using the CookieFarm framework.

Project description

🍪 CookieFarm - Exploiter Manager

Language Keywords License

Python decorator for automating exploit execution in CTF Attack & Defense competitions


📦 What is it?

This package provides a @exploit_manager decorator designed to automate the parallel execution of exploits in CTF (Attack & Defense) settings, specifically for use with the CookieFarm project.

It handles:

  • Authentication with the central server
  • Retrieving team configuration
  • Asynchronous dispatch of exploits to multiple targets
  • Automatic flag parsing from stdout

⚠️ Note: This package is not standalone. It must be used together with the CookieFarm client. The client provides the required APIs and team configurations.


📦 Installation

To install the package:

pip install cookiefarm-exploiter

⚙️ How it works

The @exploit_manager decorator takes care of:

  • Calling your exploit(ip, port, name_service) function
  • Capturing your exploit's stdout
  • Parsing flags via regex
  • Logging the result in JSON format, including: team ID, port, service name, and the flag found

All of this is done in parallel using asyncio and ThreadPoolExecutor, making the process extremely efficient, even with dozens of teams.


🚀 Example usage

from cookiefarm_exploiter import exploit_manager
import requests

@exploit_manager
def exploit(ip, port, name_service):
    # Run your exploit here
    response = requests.get(f"http://{ip}:{port}/")

    # Just print the flag to stdout
    print(response.text)

# Run from the command line with arguments from CookieFarm
# python3 myexploit.py <ip_server> <password> <tick_time> <thread_number> <port> <name_service>

For execution, you have to pass the required arguments from the command line, which are provided by the CookieFarm client. The decorator will handle the rest.

python3 myexploit.py <server_address> <tick_time> <thread_number> <port> <name_service>

Where:

  • <server_address>: The address of the CookieFarm server
  • <tick_time>: The time interval for the exploit to run
  • <thread_number>: The number of threads to use for parallel execution
  • <port>: The port of the service to exploit
  • <name_service>: The name of the service being exploited

🛠️ Requirements

  • Python ≥ 3.12
  • Working CookieFarm client installed

📝 License

Distributed under the MIT License. Feel free to use, modify, and contribute.


For any questions, suggestions, or issues, feel free to open a GitHub issue!

Created with ❤️ by ByteTheCookies (feat. @0xMatte)

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

cookiefarm-1.0.2.tar.gz (9.3 MB view details)

Uploaded Source

Built Distribution

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

cookiefarm-1.0.2-py3-none-any.whl (9.3 MB view details)

Uploaded Python 3

File details

Details for the file cookiefarm-1.0.2.tar.gz.

File metadata

  • Download URL: cookiefarm-1.0.2.tar.gz
  • Upload date:
  • Size: 9.3 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cookiefarm-1.0.2.tar.gz
Algorithm Hash digest
SHA256 fa4ca6dc69a633b4def87d5065e9d91ec95f2e9513cd9fc8889129b5499b9047
MD5 bf8876d5cc7c09251e53125af77c1bf6
BLAKE2b-256 653f0b1c8d8fa5b3e0645fd25704d831856d231ee45ec2cb737bfa279babcf63

See more details on using hashes here.

File details

Details for the file cookiefarm-1.0.2-py3-none-any.whl.

File metadata

  • Download URL: cookiefarm-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 9.3 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.3

File hashes

Hashes for cookiefarm-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cb3b532b72ccc78b08b118529856f978f49d335877f15a14f9e92d0ffc01f11c
MD5 7ad6944534072f0b146555292c4b7e86
BLAKE2b-256 f5025be8d91191f175e5a7771d60100f4ade36144bae68bf8ed4dcfcb41699bf

See more details on using hashes here.

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