Hacker lair Welcome to my blog where I write about Threat Hunting, Pentesting and Cybersecurity in general.

TTY Spawn Shell Cheat Sheet

This is a collection of one-liners commands that will allow you to spawn TTY shells!

very useful for escaping jail shells.

python -c 'import pty; pty.spawn("/bin/sh")'
echo os.system('/bin/bash')
/bin/sh -i
perl e 'exec "/bin/sh";'
perl: exec "/bin/sh";
ruby: exec "/bin/sh"
lua: os.execute('/bin/sh')
exec "/bin/sh"

From within vi

:!bash

From within vi too

:set shell=/bin/bash:shell

From within nmap

!sh