Skip to main content

Interactive Shells

This section will cover the different ways to spawn an interactive shell.

Table of Contents
  • Script
  • Python
  • Perl
  • Ruby
  • Lua
  • AWK
  • Find
  • VIM
    • VIM Escape

Script

Using the "script" command:

script -qc /bin/bash /dev/null

Python

Using "python3" command:

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

Just 'python':

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

Perl

perl -e 'exec "/bin/sh";
perl: exec "/bin/sh";

Ruby

ruby: exec "/bin/sh"

Note: The above command should be run from a script.

Lua

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

Note: The above command should be run from a script.

AWK

awk 'BEGIN {system("/bin/sh")}'

Find

find / -name nameoffline -exec /bin/awk 'BEGIN {system("/bin/sh")}' \;
find . -exec /bin/sh \; -quit

VIM

vim -c ':!/bin/sh'

VIM escape

vim
:set shell=/bin/sh
:shell