Metadata-Version: 2.4
Name: cookiefarm
Version: 1.0.2
Summary: Python decorator for parallel exploit dispatch in Attack & Defense CTFs using the CookieFarm framework.
Project-URL: Homepage, https://github.com/ByteTheCookies/CookieFarmExploiter
Author-email: ByteTheCookies <bytethecookies@proton.me>
License: MIT License
        
        Copyright (c) 2025 ByteTheCookies
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# 🍪 CookieFarm - Exploiter Manager

![Language](https://img.shields.io/badge/languages-Python-yellowgreen)
![Keywords](https://img.shields.io/badge/keywords-CTF%2C%20Exploiting%2C%20Attack%20Defense-red)
![License](https://img.shields.io/badge/license-MIT-blue)

> 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](https://github.com/BytesTheCookies/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](https://github.com/BytesTheCookies/CookieFarm). The client provides the required APIs and team configurations.

---

## 📦 Installation

To install the package:
```bash
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

```python
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.

```bash

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](LICENSE). Feel free to use, modify, and contribute.

---

For any questions, suggestions, or issues, feel free to open a [GitHub issue](https://www.github.com/BytesTheCookies/CookieFarmExploiter)!

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