Interactive TTY Stabilization & Terminal Spawning
Stabilizing non-interactive reverse shells into fully featured TTY sessions with tab-completion and terminal window resize support.
pythonsttyscriptsocat
Raw reverse shells lack arrow key navigation, tab autocompletion, job control (Ctrl+C), and editor support. Stabilizing the shell is crucial before running interactive commands like sudo or su.
1. The Standard Python + stty Technique
- Spawn pseudo-terminal in remote shell:
python3 -c 'import pty; pty.spawn("/bin/bash")'
- Background the shell:
Press Ctrl+Z.
- Configure local terminal and bring shell to foreground:
stty raw -echo; fg
- Export terminal environment and window dimensions:
export TERM=xterm-256color
stty rows 38 columns 140
2. Alternative: Using `script`
If Python is not installed on the victim:
script -qc /bin/bash /dev/null
# Then Ctrl+Z -> stty raw -echo; fg
After establishing a stable interactive TTY, proceed with 04. Linux Privilege Escalation Master Guide.
More CPTS notes
- 01. Network Discovery & Port Scanning Guide
- 02. Web Content Discovery & Directory Fuzzing
- 03. Web Application Exploitation & Injection
- 04. Linux Privilege Escalation Master Guide
- 05. Windows Local Privilege Escalation & LOLBAS
- 06. Active Directory Attack Paths & Domain Enumeration
- 07. Kerberos Exploitation: AS-REP & Kerberoasting
- 08. Active Directory Certificate Services (AD CS) Abuse
- 09. Pivoting, Tunnels & Lateral Movement
- 10. Password Cracking & Hash Identification
- 11. Offensive File Transfers Across Restricted Networks
Keep these notes in your own private vault. Open CPTS notes in ZeroBox