
NetSpyC2 – Python C2 Server with RSA Key Exchange and AES-GCM Encrypted Sessions
NetSpyC2 is a Python-based Command & Control (C2) server created for educational purposes, security research, and controlled laboratory environments.
The project demonstrates how encrypted client-server communication, session management, and secure file transfer can be implemented at the application protocol level using Python.
NetSpyC2 does not rely on external TLS stacks. Instead, it implements its own cryptographic handshake and encrypted channel using modern primitives.
NetSpyC2 establishes secure communication in the following steps:
Each connected client maintains its own independent encrypted session.
cryptography Python packageprompt_toolkit Python packageInstall dependencies:
pip install cryptography
pip install prompt_toolkit
Start the C2 server:
python3 NetSpy2.py
Default configuration:
0.0.0.04444The server generates a fresh RSA key pair at startup.
Available commands in the NetSpyC2 console:
help – Display the help menulist – List all active client sessionsselect <ID> – Interact with a specific clientinfo – Display server logsrsa keys – Show RSA public and private keysset host <HOST> – Change listening hostset port <PORT> – Change listening portbanner – Display bannerexit – Shutdown serverAny unrecognized command is executed locally on the server.
Inside a selected session:
get <file> – Download file from clientput <file> – Upload file to clientAll file transfers are encrypted and verified using SHA-256.
Logs are written to:
NetSpyC2Server.log
.
├── NetSpy2.py
├── banner.py
├── colores.py
├── NetSpyC2Server.log
└── README.md
This project is intended for educational, research, and controlled lab use only.
Unauthorized use against systems you do not own or have permission to test is prohibited.
Creative Commons Attribution–NonCommercial–ShareAlike 4.0 International (CC BY-NC-SA 4.0)
You may modify and redistribute this project for non-commercial purposes only, provided that you preserve this license and give proper attribution.
This software is provided for educational and research purposes only.
Use only on systems and networks you own or have explicit authorization.