After connecting to a target system using reverse shell you can use this techniques for stabilizing the shell
Technique 1
First check if python is installed in the target system
For checking the python use command {python — version} OR {python3 — version}
if there is no error and you get the version then you are good to go to use this technique
STEP 1. Type python -c ‘import pty; pty.spwan(“/bin/bash”)’
#note: some targets may need the version of Python specified
STEP2:export TERM=xterm (this will give us access to term commands such as clear)
Finally (and most importantly) we will background the shell using Ctrl + Z. Back in our own terminal we use stty raw -echo; fg. This does two things: first, it turns off our own terminal echo (which gives us access to tab autocompletes, the arrow keys, and Ctrl + C to kill processes). It then foregrounds the shell, thus completing the process.
Technique 2
For this technique we will need an additional tool in our local machine called rlwrap. To install this tool use apt install.
For this technique we have to use rlwrap before connecting to remote machine
Command — rlwrap nc -lvnp port_number
Technique 3
Most Easy way is this
Type these commands after connecting to the remote server
/usr/bin/script -qc /bin/bash /dev/null
Then background the shell using crtl+z
Then type
stty raw -echo
then type
fg nc prt_no. that you used to connect to the remote machine eg. fg nc 1234
then type