Skip to content

Often during pentests you may obtain a shell without having tty, yet wish to interact further with the system.

Notifications You must be signed in to change notification settings

chikyukrish/TTY-Shell

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 

Repository files navigation

TTY-Shell

GitHub Repo stars

Here are some commands which will allow you to spawn a tty shell. Obviously some of this will depend on the system environment and installed packages.

match the target system

Shell Spawning

  • python -c 'import pty; pty.spawn("/bin/bash")'
  • python -c 'import pty; pty.spawn("/bin/sh")'
  • python3 -c 'import pty; pty.spawn("/bin/bash")'
  • python3 -c 'import pty; pty.spawn("/bin/sh")'
  • echo os.system('/bin/bash')
  • /bin/sh -i
  • perl —e 'exec "/bin/sh";'
  • perl: exec "/bin/sh";
  • ruby: exec "/bin/sh"

(From within IRB)

  • exec "/bin/sh"

(From within vi)

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

(From within nmap)

  • !sh

Example

Listening using nc -nvlp <PORT> and we get back connect

  • And we can search for python in the system using which python or which python3

About

Often during pentests you may obtain a shell without having tty, yet wish to interact further with the system.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published