Skip to content

hsjafari/C2

Repository files navigation

C2-v2.0 Django Project

This project is a Command & Control (C2) server built with Django. It provides several API endpoints for agent registration, command delivery, result submission, and file upload. The server uses HTTPS for secure communication. Screenshot from 2025-08-23 18-25-35 Screenshot from 2025-08-23 18-28-36 Screenshot from 2025-08-23 18-28-50

Features

  • Agent registration and persistence check
  • Command delivery to agents
  • Result submission from agents
  • File upload support
  • Secure HTTPS server

API Endpoints

POST /reg/

Parameters:

  • ComputerName (string): Name of the computer
  • FQDNUser (string): FQDN user
  • hash_id (string): Unique agent ID

Response:

{
  "status": "true",
  "isPersisted": "<true|false>"
}

POST /is_per/

Parameters:

  • hash_id (string): Unique agent ID

Response:

{
  "status": "true"
}

POST /get_cmd/

Parameters:

  • hash_id (string): Unique agent ID

Response:

{
  "command": "<command string>",
  "id": "<command id>"
}

POST /send_res/

Parameters:

  • hash_id (string): Unique agent ID
  • result (string): Command result

Response:

{
  "status": "result saved"
}

POST /upload/

Parameters:

  • File upload parameters (see implementation)

Response: Standard file upload response


Running the Server

To run the server with HTTPS enabled:

python3 manage.py runserver_plus --cert-file cert.pem --key-file key.pem 0.0.0.0:8000

Generating SSL Certificate and Key

To generate a self-signed certificate and key for development, use the following command:

openssl req -x509 -newkey rsa:4096 -keyout key.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost"

This will create cert.pem and key.pem files in your project directory. Use these files to run the server securely..


Requirements

Install dependencies with:

pip install -r requirements.txt

License

MIT License

About

c2 server using Django

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages