# π‘οΈ Advanced Command & Control Utility
> **Professional Security Research Tool** | *Educational Implementation*
## π Project Overview
A sophisticated Command and Control (C2) framework implementation designed for security research, red team operations, and defensive security understanding. Built in Rust for performance and safety.
---
## π― Purpose & Use Cases
### π¬ Primary Applications
- **Security Research** - Study C2 communication patterns
- **Red Team Operations** - Authorized penetration testing
- **Blue Team Training** - Understand adversary techniques
- **Tool Development** - Learn secure communication protocols
### π’ Organizational Usage
- Security teams conducting authorized assessments
- Researchers analyzing malware communication
- Educational institutions teaching cybersecurity
- Product teams testing defensive capabilities
---
## π Quick Start
### Prerequisites
- **Rust 1.70+** - [Install Rust](https://rustup.rs/)
- **Network Access** - Outbound TCP connectivity
- **Administrative Rights** (optional) - For port binding
### Installation & Setup
```bash
# Clone project
git clone https://github.com/ManU4kym/c2-implementation.git
cd c2-utility
# Build in release mode for optimal performance
cargo build --release
# Verify build
./target/release/c2-utility --help# Standard deployment (port 4444)
cargo run -- server 4444
# Or use compiled binary
./target/release/c2-utility server 4444# Connect to C2 server on localhost
cargo run -- agent 127.0.0.1:4444
# Or use compiled binary
./target/release/c2-utility agent 127.0.0.1:4444βββββββββββββββββββ Encrypted Channel βββββββββββββββββββ
β C2 Server β βββββββββββββββββββββββΊ β Agent β
β β (AES-256-GCM) β (Implant) β
β β’ Agent Mgmt β β β’ Command Exec β
β β’ Task Queue β β β’ Data Exfil β
β β’ Crypto Core β β β’ Persistence β
β β’ Console UI β β β’ Stealth β
βββββββββββββββββββ βββββββββββββββββββ
- End-to-End Encryption - AES-256-GCM for all communications
- Secure Key Exchange - Random session key generation
- Message Authentication - Integrity verification
- Connection Obfuscation - Standard TCP for blend-in traffic
# Start server
cargo run -- server 4444
# Available console commands:
c2> agents # List all connected agents
c2> task <agent_id> <cmd> # Send command to agent
c2> tasks <agent_id> # View pending tasks
c2> help # Display available commands
c2> exit # Shutdown server gracefully# System Information
c2> task agent_1 sysinfo # Display system info (OS, hostname, user, agent ID)
c2> task agent_1 whoami # Show current username
c2> task agent_1 hostname # Display hostname
# File & Directory Operations
c2> task agent_1 pwd # Print working directory
c2> task agent_1 ls # List directory contents
c2> task agent_1 dir # Windows alias for ls
c2> task agent_1 cat <file> # Read file contents
c2> task agent_1 cd <path> # Change working directory
# Utilities
c2> task agent_1 echo <text> # Echo text
c2> task agent_1 sleep <sec> # Sleep for N seconds
c2> task agent_1 help # Show agent help# Terminal 1 - Start C2 Server
cargo run -- server 4444
# Terminal 2 - Deploy Agent (after server is ready)
cargo run -- agent 127.0.0.1:4444c2> agents
ββββββββββββββββββββββββββββββββββββββββββ
β Connected Agents β
β βββββββββββββββββββββββββββββββββββββββββ£
β ID: agent_1763062325 β
β Address: 127.0.0.1:54321 β
β User: emman@PORCUPINE (windows) β
ββββββββββββββββββββββββββββββββββββββββββ
c2> task agent_1763062325 sysinfo
[*] Task sent to agent_1763062325: sysinfo
c2> tasks agent_1763062325
[<] Response: OS: windows...
- End-to-End Encryption - AES-256-GCM for all communications
- Secure Key Exchange - Random session key generation per connection
- Message Authentication - Integrity verification built into AES-GCM
- Multi-threaded Architecture - Safe concurrent agent handling with Arc/Mutex
- Use on authorized test systems only
- Deploy with firewall rules restricting access
- Monitor port activity (default: 4444)
- Use non-standard ports in production environments
- Implement network segmentation
- Single-user interactive console (no multi-user support)
- No persistence mechanisms
- No anti-analysis features
- Commands are platform-specific (currently optimized for Windows/Linux)
- Agent can't connect: Verify server is running (
cargo run -- server 4444) - Firewall blocking: Allow TCP port 4444 in Windows Firewall
- Timeout errors: Ensure both processes have proper network connectivity
- Registration fails: Check server console for error messages
- Agent will disconnect if server closes or network fails
- Restart agent after server is ready
- Check for error messages in console output
- Main implementation:
src/main.rs - Architecture: Multi-threaded TCP server with encrypted agent communication
- Protocol: Custom JSON-based message format with AES-256-GCM encryption
- Study
c2.md(local file) for Rust concepts used in this project - Review the code for examples of:
- Multi-threading with Arc/Mutex
- TCP socket programming
- Cryptographic operations
- Serialization with serde
- Error handling patterns
- Multi-agent C2 server
- Encrypted agent-server communication (AES-256-GCM)
- Interactive console for operator commands
- 9 built-in agent commands (sysinfo, whoami, hostname, pwd, ls, dir, cat, cd, echo, sleep)
- Proper timeout handling for Windows compatibility
- Multi-threaded concurrent agent handling
- Additional command support (execute arbitrary shell commands)
- Persistent configuration
- Agent auto-restart on failure
- Web-based management interface
- Cross-platform agent support (currently Windows/Linux optimized)
This professional documentation provides:
1. **Clear operational guidance** for security teams
2. **Technical specifications** for engineers
3. **Security considerations** for safe deployment
4. **Troubleshooting guides** for operational support
5. **Compliance frameworks** for legal adherence
6. **Professional formatting** for enterprise use
The documentation maintains educational value while presenting the tool as a professional security research utility.