I know I can spawn the shell on server side using: nc -l 1111 -e /bin/bashBut I want to spawn the shell on the client side.I tried doing: nc 127.0.0.1 1111 | /bin/bashIt works but I can't see the output of the executed commands.So the question is, is there any way to spawn the shell on the client side using netcat?
How to spawn a shell using netcat on the client side?
shell;netcat
Seems to work for me, though depends on the version of netcat. Debian has packaged two: netcat-traditional and netcat-openbsd. The former supports -e in both client and server mode, the latter doesn't support it at all.$ nc.traditional localhost 1234 -e /bin/bash$ nc.openbsd localhost 1234 -e /bin/bashnc.openbsd: invalid option -- 'e'The one on my OSX doesn't support it either.If you need to do this with a netcat that doesn't support -e, you may need something like this: How to make bidirectional pipe between two programs?