A Command & Control (C2) framework written in C++ for Windows x64 systems.
This project simulates a real-world offensive security infrastructure used to remotely control multiple machines (agents) from a central server.
It is designed to demonstrate how attackers (or red teamers) build scalable systems to:
- maintain access to machines
- execute commands remotely
- manage multiple targets simultaneously
- π§ Full C2 architecture (server β agents)
- π TCP communication using Winsock (low-level networking)
- π₯ Multi-agent handling with
select()(no threads per client) - π Time-based authentication (anti-unauthorized access)
- π» Remote command execution via hidden processes
- πͺ Stealth agent (no console / background execution)
- π Logging system (server-side activity tracking)
- π¨ ANSI CLI interface (operator feedback)
This is NOT a simple reverse shell.
It implements core concepts found in real C2 frameworks:
- Agent β Server communication protocol
- Authentication layer
- Multi-client orchestration
- Command execution pipeline
- Basic OPSEC considerations (stealth, timing, minimal footprint)
src/
βββ client/ # Agent (executed on target machine)
β βββ main.cpp
βββ server/ # C2 server (operator side)
β βββ main.cpp
β βββ class/
β β βββ client.cpp
β β βββ server.cpp
β βββ cli/
β β βββ cli.cpp # Operator command interface
β βββ log/
β βββ log.cpp
Using MinGW / MSYS2:
mingw32-make reclient.exeβ Agent (debug mode)client_no_console.exeβ Agent (stealth mode)server.exeβ C2 server
./server.exe./client.exeor stealth mode:
./client_no_console.exe- Connects to the C2 server
- Sends authentication token
- Sends hostname (target identification)
- Waits for commands
- Executes instructions and returns output
- Shared secret hardcoded
- Time-based rotation (every 30 seconds)
- Prevents unauthorized connections
- Commands sent from C2 server
- Executed using
CreateProcess - No visible window (
CREATE_NO_WINDOW) - Output captured via pipes
- Sent back to operator
-
Uses
select()for scalability -
No thread-per-client overhead
-
Tracks:
- authentication state
- hostname
- connection time
Logs stored in:
other/logs/log.txt
Example:
Succes auth
- Execute system commands remotely
- Identify active machines (hostname)
- Drop unauthenticated agents
- Blacklist specific IPs
This project is for educational and authorized security research only.
It is intended to demonstrate:
- how C2 infrastructures work
- how attackers manage remote systems
- how defensive teams can understand these mechanisms
Do NOT use on systems without explicit permission.
- π TLS encryption (secure communications)
- π§© Modular command system (plugin-based tasks)
- π Advanced logging (timestamps, agent IDs)
- π Auto-reconnect agents (persistence)
- π Cross-platform agents (Linux)
- π§ Task queue system (async execution)
- π‘ Advanced OPSEC features
Built as part of a low-level systems and offensive security learning journey.
Focus: scalability, realism, and understanding of modern C2 design.