Skip to content

About

TCP reverse shell for Windows πŸ’» Lightweight and efficient implementation using socket-based communication. Built for cybersecurity education, demonstrating remote command execution, networking concepts, and post-exploitation techniques in a controlled environment βš‘πŸ”

Resources

Stars

2 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

23 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 C2-Windows-x64 - Command & Control Framework

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

πŸš€ Features

  • 🧠 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)

🎯 What this project demonstrates

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)

πŸ“ Project Structure

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

βš™οΈ Build

Using MinGW / MSYS2:

mingw32-make re

πŸ”§ Generated binaries

  • client.exe β†’ Agent (debug mode)
  • client_no_console.exe β†’ Agent (stealth mode)
  • server.exe β†’ C2 server

▢️ Usage

1. Start the C2 server

./server.exe

2. Execute the agent on a target machine

./client.exe

or stealth mode:

./client_no_console.exe

🧠 Architecture

πŸ”Œ Agent lifecycle

  1. Connects to the C2 server
  2. Sends authentication token
  3. Sends hostname (target identification)
  4. Waits for commands
  5. Executes instructions and returns output

πŸ”‘ Authentication system

  • Shared secret hardcoded
  • Time-based rotation (every 30 seconds)
  • Prevents unauthorized connections

πŸ’» Remote command execution

  • Commands sent from C2 server
  • Executed using CreateProcess
  • No visible window (CREATE_NO_WINDOW)
  • Output captured via pipes
  • Sent back to operator

πŸ‘₯ Multi-agent management

  • Uses select() for scalability

  • No thread-per-client overhead

  • Tracks:

    • authentication state
    • hostname
    • connection time

πŸ“„ Logging

Logs stored in:

other/logs/log.txt

Example:

Succes auth

πŸ§ͺ Example Operations

  • Execute system commands remotely
  • Identify active machines (hostname)
  • Drop unauthenticated agents
  • Blacklist specific IPs

⚠️ Disclaimer

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.


πŸ’‘ Roadmap

  • πŸ”’ 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

πŸ§‘β€πŸ’» Author

Built as part of a low-level systems and offensive security learning journey.

Focus: scalability, realism, and understanding of modern C2 design.

About

TCP reverse shell for Windows πŸ’» Lightweight and efficient implementation using socket-based communication. Built for cybersecurity education, demonstrating remote command execution, networking concepts, and post-exploitation techniques in a controlled environment βš‘πŸ”

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages