Skip to content

MedSaher/silk-thread

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🧠 Silk Thread - C++ Reverse Shell C2 Framework (Windows)

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.


πŸ“¦ Components

πŸ–₯️ client/

  • main.cpp
    The reverse shell client that connects to the remote server and executes received commands using Windows APIs.

πŸ“‘ server/

  • 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.

πŸ”§ Requirements

  • Target OS: Windows (client), Linux or Windows (server)
  • Language: C++
  • Compiler: g++, clang++, or MSVC
  • Libraries:
    • Winsock2 (on Windows)
    • Standard C++ STL

πŸš€ Building the Project

πŸ”¨ Build Client (Windows)

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

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages