TTY Shell

Sometimes when we get a reverse shell, the received shell may not be fully functional.

The following commands will allow us to spawn a proper shell.

Python -
    python -c 'import pty; pty.spawn("/bin/sh")'
    python3 -c 'import pty;pty.spawn("/bin/bash")'; export TERM=xterm-256color

Bash -
    echo os.system('/bin/bash')
    /bin/sh -i
    /bin/bash -i
    script -qc /bin/bash /dev/null

Perl -
    perl -e 'exec "/bin/sh";'
    exec "/bin/sh";

Ruby: exec "/bin/sh"

Lua: os.execute('/bin/sh')

IRB: exec "/bin/sh"

vi: :!bash

vi: :set shell=/bin/bash:shell

Nmap: !sh

Last updated