During the infiltration process, I found that the shell rebound with nc -e was not easy to use at all. I didn't know how to use it. It was especially troublesome and easily affected the efficiency and emotion of infiltration. Therefore, I did a lot of Baidu and finally found a perfect rebound. Shell method.
python ‐c "import pty;pty.spawn('/bin/bash')"
python -c 'import pty;pty.spawn("/bin/sh")'
Use the pty module provided by python to create a native terminal
Ctrl-C) will still close and terminate Netcat, and there is still no completion tag or history record
ctrl + z (suspend the shell in the background)
stty raw ‐echo
fg + multiple carriage returns
stty rows 34 cols 136
stty cols 25
sets the column to 25 rows and finds that the output becomes narrower
export TERM=xterm
Set some stty options in the kali terminal, and finally upgraded the "dumb" netcat shell to a fully interactive TTY.
stty is a common command used to change and print terminal line settings.
stty -a view information
stty -echo setting command is not displayed
stty raw #Set the original input
stty -raw #Close raw input
stty size print the current number of terminals and columns