Upgrade to Fully Interactive TTYs
At a Glance
More often than not, reverse, or bind shells are shells with limited interactive capabilities. Meaning no job control, no auto-completion, no
STDERR output, and, most important, poor signal handling and limited commands support. To fully leverage the shell it is convenient to upgrade to an interactive TTY with extended features.
To check if the shell is a TTY shell use the
Shell to Bash
Upgrade from shell to bash.
SHELL=/bin/bash script -q /dev/null
Python PTY Module 1
/bin/bash using Python’s PTY module, and connect the controlling shell with its standard I/O.
python -c 'import pty; pty.spawn("/bin/bash")'
Fully Interactive TTY
Background the current remote shell (
^Z), update the local terminal line settings with
stty2 and bring the remote shell back.
stty raw -echo && fg
After bringing the job back the cursor will be pushed to the left. Reinitialize the terminal with