Shell Balancing

after initial access into machine we need to stable our shell so there are various ways to do this we will be looking over them ..

Example of Bad shell

Upgrade reverse shell to fully usable TTY shell

rlwrap

  • During reciving connection form target machine we can use rlwrap

  • we can also mitigate some of the restrictions of poor netcat shells by wrapping the netcat listener with the rlwrap command.

  • This is not installed by default so we need to install it using sudo apt rlwrap.

rlwrap nc -lvnp $port 		

Using env-call and script

  • This is a generic shell command that receive the default system shell.

SHELL=/bin/bash script -q /dev/null		

Using Script

  • script comes pre-installed

  • check the man page

  • -q is for quite , -c is for command

ctrl+z

Python

  • Python is great tool for balancing the shell.

ctrl+z

Perl

  • If python is not installed or perl avilable on box then we can use this .

Ruby

  • if ruby is installed on box.

Lua

Copy over NC and spawn a shell

  • Using wget and python's SimpleHttpServer NC was easily moved over to the target

  • here we copy nc to victum machine and then receive the shell.

Socat

  • never sue nc while receiving connections ,use socat it will give you more generic shell like ssh.

Last updated