Skip to main content
This guide walks through installing the C2 Framework and all required dependencies on both the server (Ubuntu) and agent (Windows) systems.
This framework is designed exclusively for isolated lab environments. Never deploy on production networks or internet-facing systems.

Prerequisites

Ubuntu Server VM

  • Ubuntu 22.04 LTS or later
  • Python 3.11+
  • Docker and Docker Compose (for containerized deployment)
  • OpenSSL for certificate generation
  • Git for source code management

Windows Agent VM

  • Windows 10 or later
  • Python 3.11+ (for agent execution)
  • Administrator access (for hosts file modification)

Server Installation

Step 1: Clone the Repository

On the Ubuntu server VM:
cd ~
git clone <repository-url> c2-framework
cd c2-framework

Step 2: Install Python Dependencies

The framework requires the following key dependencies:
# Install pip if not present
sudo apt update
sudo apt install python3-pip python3-venv -y

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Step 3: Core Dependencies

The requirements.txt includes these essential packages:
PackageVersionPurpose
fastapi0.133.1Web framework for C2 server
uvicorn0.41.0ASGI server for FastAPI
aiosqlite0.22.1Async SQLite for session/task storage
cryptography46.0.5TLS and encryption primitives
pydantic2.12.5Data validation and serialization
requests2.32.5HTTP client for agent
scapy2.7.0Network packet manipulation
httpx0.27.2Async HTTP client
pytest9.0.2Testing framework
pytest-asyncio1.3.0Async test support
PyYAML6.0.3Configuration parsing

Step 4: Install OpenSSL

Required for TLS certificate generation:
sudo apt install openssl -y
openssl version

Agent Installation

Step 1: Install Python on Windows

1

Download Python

Download Python 3.11+ from python.org
2

Run Installer

  • Check “Add Python to PATH”
  • Choose “Install Now”
  • Verify: Open PowerShell and run python --version
3

Install Dependencies

Copy the agent code and install required packages:
cd C:\Users\<username>\c2-framework
python -m pip install requests cryptography pyyaml

Step 2: Copy Agent Files

Transfer the following directories from the Ubuntu VM to the Windows VM:
c2-framework/
├── agent/           # Agent execution engine
├── common/          # Shared crypto, message formats, config
├── transport/       # TLS wrapper and communication
└── evasion/         # Anti-analysis checks (optional)
Never copy certs/server.key to the Windows VM. Only the public certificate (certs/server.crt) should be transferred.

Verify Installation

Server Verification

# Activate virtual environment
source venv/bin/activate

# Test imports
python -c "import fastapi, uvicorn, aiosqlite; print('Server dependencies OK')"

# Check Docker (if using containerized deployment)
docker ps

Agent Verification

# Test imports
python -c "import requests, cryptography; print('Agent dependencies OK')"

# Verify agent module
python -c "from agent.agent_main import main; print('Agent module OK')"

Directory Structure

After installation, the project structure should look like this:
c2-framework/
├── agent/                    # Agent components
│   ├── agent_main.py        # Agent entry point
│   ├── beacon.py            # Beacon logic
│   ├── executor.py          # Command execution
│   ├── jitter.py            # Timing jitter
│   └── environment_checks.py # Anti-analysis
├── server/                   # Server components
│   ├── server_main.py       # FastAPI server
│   ├── session_manager.py   # Session tracking
│   ├── command_queue.py     # Task queuing
│   └── storage.py           # Database layer
├── common/                   # Shared modules
│   ├── config.py            # Configuration (create from example)
│   ├── config_example.py    # Configuration template
│   ├── crypto.py            # Encryption primitives
│   ├── message_format.py    # Protocol definitions
│   └── logger.py            # Logging utilities
├── transport/                # Communication layer
│   └── tls_wrapper.py       # TLS/certificate pinning
├── redirector/               # Nginx frontend
│   ├── nginx_docker.conf    # Docker Nginx config
│   ├── nginx_main.conf      # Main Nginx config
│   └── Dockerfile.nginx     # Nginx container
├── certs/                    # TLS certificates (gitignored)
├── logs/                     # Runtime logs and database
├── tests/                    # Unit and integration tests
├── docker-compose.yml        # Container orchestration
├── Dockerfile                # Server container
└── requirements.txt          # Python dependencies

Next Steps

After completing the installation:
  1. Lab Setup - Configure the lab network and generate certificates
  2. Quickstart - Run the server and connect your first agent

Troubleshooting

Python Version Mismatch

If you encounter module import errors, verify Python version:
python3 --version  # Should be 3.11 or higher

Docker Permission Denied

If docker commands fail with permission errors:
sudo usermod -aG docker $USER
# Log out and log back in

Missing System Packages

On Ubuntu, install build essentials if cryptography fails:
sudo apt install build-essential libssl-dev libffi-dev python3-dev -y

Build docs developers (and LLMs) love