1.First spawn a PTY shell with python or with bash ,
2. Background the process with Ctrl-z
3. Examine the current terminal and STTY info so we can force the connected shell to match it:
The information needed is the size of the current TTY (“Example: rows 38; columns 116”)
4. With the shell still backgrounded, now set the current STTY to type raw and tell it to echo the input characters with the following command:
With a raw stty, input/output will look weird and you won’t see the next commands, but as you type they are being processed.
5. Next foreground the shell with fg. It will re-open the reverse shell but formatting will be off. Finally, reinitialize the terminal with enter button
6. After the reset the shell should look normal again. The last step is to set the shell, terminal type and stty size to match our current Kali window (from the info gathered above)
The end result is a fully interactive TTY with all the features we’d expect (tab-complete, history, job control, etc) all over a netcat connection :)
Obtaining a full interactive shell with zsh
Current kali terminal come with zsh shell so it's important to learn this method as above will not work with zsh shell
1.Get tty shell with above commands and then background the process with ctrl+z
2. Get the number of rows and columns with
3. To ignore hotkeys in the local shell and return to your reverse shell, enter