Obtaining a Fully Interactive Shell

Type your comment> @KeyboardCaper said:

After getting a terminal:

python -c ‘import pty; pty.spawn(“/bin/bash”)’
CTRL-z
bg
stty raw -echo
fg
reset
(In case of unknown terminal type try: linux)

Optional:
export SHELL=/bin/bash
export TERM=xterm-color
export HOME=

Then fix up the rows and columns. Open another terminal
stty -a

Get the rows and columns.

Back on your reverse shell:
stty rows <> columns <>

Rarely does the python part not work… when it doesn’t I simply find a work around or just deal with what I have.

Probably good to note for this that python -c 'import pty;pty.spawn("/bin/bash")' won’t work with any versions of Python3, so specifying python3 -c ... is necessary. Otherwise solid description, you nailed it to a “T”.