Shells/TTYs
Teletypewriters
Get a Full TTY
BASH
BASHpython3 -c 'import pty; pty.spawn("/bin/bash")'CTRL+Z
stty raw -echo; fg; ls; export SHELL=/bin/bash; export TERM=screen; stty rows 38 columns 116; reset;
ZSH
ZSHpython3 -c 'import pty; pty.spawn("/bin/bash")'CTRL+Z
stty raw -echo; fg %1; export SHELL=/bin/bash; export TERM=screen; stty rows 38 columns 116; reset;
Clear Terminal
export TERM=xtermTerminal Size
stty sizestty rows <NUMBER> columns <NUMBER>Use arrow-keys
bashset -o historyIn the
.bashrcfile, make sureHISTSIZEis not set to0:
HISTSIZE=1000
HISTFILESIZE=1000rlwrap enables line editing and history:
rlwrap nc -lvnp <port>rlwrap nc 10.10.10.131 6200Spawning Shells
The pty module in Python allows you to spawn a new process in a pseudo-terminal, effectively creating an interactive shell:
The script command starts a shell session and records the session to a file. /dev/null is specified as the file where the session is "recorded", but since it's /dev/null, no logging actually happens:
Also is possible to use echo to pass Python os.system('/bin/bash') to the Python interpreter:
Spawn an interactive shell directly from the terminal:
The command exec "/bin/sh" replaces the running Perl process with a new /bin/sh shell:
Ruby's exec function, like in Perl, replaces the current process with a new process—in this case, /bin/sh:
Runs a shell command from Lua, but unlike in Perl or Ruby, this does not replace the current process. It runs /bin/sh as a child process:
Replaces the current Ruby interpreter (IRB) with the shell:
Used to execute an external shell command:
Changes the default shell used by vim's :! command:
Spawn a shell from within the nmap interface, enabling the execution of additional shell commands while scanning:
Node-Red Reverse shell
Once you received the connection use another listener you get a more stable shell:
Then use
script:
Bind Shells
First, find ports were
inboundconnections are allowed:
Check the firewall rules in Windows:
Last updated