Silk Thread is a minimal, educational reverse shell system implemented in modern C++, comprising a Windows client and a C2 server. This project demonstrates the fundamentals of client-server socket programming, reverse connections, and remote command execution using native APIs.
β οΈ DISCLAIMER
This project is provided strictly for educational and research purposes.
Unauthorized use of this software on systems you do not own or have explicit written permission to test is illegal and unethical.
The author assumes no responsibility for misuse.
main.cpp
The reverse shell client that connects to the remote server and executes received commands using Windows APIs.
main.cpp
The listener-based C2 server waiting for incoming connections.commands.cpp
Logic to process received input and send it to the client.helperFuncs.cpp
Support functions (e.g., string parsing, formatting).header.hpp
Common headers and shared declarations.
- Target OS: Windows (client), Linux or Windows (server)
- Language: C++
- Compiler: g++, clang++, or MSVC
- Libraries:
- Winsock2 (on Windows)
- Standard C++ STL
g++ client/main.cpp -o silk-client.exe -lws2_32
π¨ Build Server (Linux/macOS)
g++ server/*.cpp -o silk-server
π You may also use the provided script.sh for compilation.
π§ͺ How It Works
The client initiates a reverse TCP connection to the server.
Once connected, it listens for command strings from the server.
It executes each command using the system shell and sends back the output.
The server receives the output and displays it to the operator.
π Directory Layout
silk-thread-cpp/
βββ client/
β βββ main.cpp
β βββ script.sh
βββ server/
β βββ main.cpp
β βββ commands.cpp
β βββ helperFuncs.cpp
β βββ header.hpp
β βββ script.sh
π§ Learning Objectives
This project is a hands-on introduction to:
Reverse shell principles and TCP sockets
Cross-platform client-server communication
Process creation and command execution in Windows (CreateProcess, popen, etc.)
Memory management and secure string handling
Basic modular design in C++
Ethical hacking and malware behavior analysis
π Legal Use Cases
Permitted uses include:
Security labs or pentesting simulations in controlled environments
Malware reverse engineering education
Red team exercise development
C2 communication protocol design
β Prohibited Use
You must not use this software for:
Unauthorized penetration testing
System compromise or espionage
Malware creation or propagation
Attacking public or private infrastructure
π License
MIT License β refer to the LICENSE file (if included) or treat as open-source with credit.
π§© Future Enhancements (Optional)
Add XOR/encryption between client-server messages
Support multiple concurrent clients (multi-threaded C2)
Build a GUI operator console
Implement persistence methods (educational use only)
Integrate logging and session tracking
π€ Contributions
Contributions are welcome, provided they respect the educational and ethical purpose of this project.
Author: Saher Mohamed
GitHub: github.com/MedSaher
Contact: mohamed.saher.23@ump.ac.ma