This project is developed for educational purposes only. The aim is to understand and demonstrate the security risks associated with C2 and to encourage the development of effective countermeasures. The author(s) of this project do not endorse any malicious use of the materials provided.
By using or interacting with this software in any way, you agree to use it solely for educational, ethical hacking, and security research purposes. It is strictly forbidden to use the software for illegal activities, and the author(s) will not be responsible for any misuse of the software.
All users are encouraged to report any vulnerabilities or security issues found within this software to the author(s) for improvement. Remember, unauthorized access to computer systems is illegal and punishable by law. Always conduct your security research within legal boundaries and with proper authorization.
Use this software at your own risk.
To set up the environment, you can use Poetry. If you don't have Poetry installed, you can install it using the following command:
curl -sSL https://install.python-poetry.org | python3 -After installing Poetry, you can create a new virtual environment and install the dependencies by running the following commands:
poetry installWe use Caddy locally to handle HTTPS and WebSocket proxying properly (for compatibility with browsers and frontend).
sudo apt update
sudo apt install -y debian-keyring debian-archive-keyring apt-transport-https curl gnupg
curl -fsSL https://dl.cloudsmith.io/public/caddy/stable/gpg.key | gpg --dearmor | sudo tee /usr/share/keyrings/caddy-stable-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/caddy-stable-archive-keyring.gpg] https://dl.cloudsmith.io/public/caddy/stable/deb/debian any-version main" | sudo tee /etc/apt/sources.list.d/caddy-stable.list > /dev/null
sudo apt update
sudo apt install caddy
Edit /etc/caddy/Caddyfile with:
sudo rm /etc/caddy/Caddyfile
sudo nano /etc/caddy/Caddyfilelocalhost {
reverse_proxy 127.0.0.1:5000 {
transport http {
versions h1
}
}
}sudo systemctl restart caddyAfter that, the API will be accessible via
https://localhost
Flask runs without SSL (Caddy manages HTTPS as reverse proxy):
poetry run cmdTo initialize Flask-Migrate, run the following command:
$env:FLASK_APP = "src.chaos_must_die_api.app" # PowerShell (Windows)
export FLASK_APP=src.chaos_must_die_api.app # Linux / macOS
poetry run flask db init
poetry run flask db migrate -m "Initial migration."
poetry run flask db upgradeTo migrate the database, run the following command:
poetry run flask db migrate -m "Migration message."
poetry run flask db upgradeTo seed the database, run the following command:
poetry run seedThe seed script is located in the src/chaos_must_die_api/seeds/ file. You can modify the seed script to add your own data to the database.