10-16-2017, 12:06 AM
I want to share with you a very quick and simple technique to turn your fragile netcat shell into a fully-featured shell, with tab completion, job control, and all.
I've seen this talked about on a couple blogs but it seems to not be a very well known trick so I wanted to share it.
You're probably already familiar with 'python -c 'import pty;pty.spawn("/bin/sh")'. This is good but it lacks many features that would make life easier.
Next time you get a shell with netcat, do the python trick or similar to get a tty, then use CTRL+Z to background it:
Now get the information for the current shell:
All you need here is the term type "xterm-256color" and the window size "rows 24; columns 80".
Now set the current terminal type to "raw" and set it to echo input characters:
With stty as "raw" you will not see the commands and will have to type blindly for a second. Use 'fg' to bring the nc shell to the foreground. Once you're back in the nc shell use 'reset' to reset the terminal. It will look a little off.
After you've reset, define the terminal attributes in the netcat shell:
That should be it.
Linked articles [Clearnet]
I've seen this talked about on a couple blogs but it seems to not be a very well known trick so I wanted to share it.
You're probably already familiar with 'python -c 'import pty;pty.spawn("/bin/sh")'. This is good but it lacks many features that would make life easier.
Next time you get a shell with netcat, do the python trick or similar to get a tty, then use CTRL+Z to background it:
Hidden Content
Now get the information for the current shell:
Hidden Content
All you need here is the term type "xterm-256color" and the window size "rows 24; columns 80".
Now set the current terminal type to "raw" and set it to echo input characters:
Hidden Content
With stty as "raw" you will not see the commands and will have to type blindly for a second. Use 'fg' to bring the nc shell to the foreground. Once you're back in the nc shell use 'reset' to reset the terminal. It will look a little off.
After you've reset, define the terminal attributes in the netcat shell:
Hidden Content
That should be it.
Linked articles [Clearnet]
[To see links please register here]
[To see links please register here]
[To see links please register here]