netcat man page: -e emulation

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view

netcat man page: -e emulation

Pete Vickers

The traditional netcat had a -e option to "Execute the specified  
command, using data from the network for stdin, and sending stdout  
and stderr to the network..."
Whilst I can understand that this option might not be desirable to be  
included in the binary (for security reason ?), I occasionally find  
it very useful, and so emulate it with a shell script:

$ cat wetcat
mkfifo -m 600 $FIFO
($CMD < $FIFO )  2>&1 | nc -l $LISTEN_PORT > $FIFO
rm $FIFO

If others would find it useful too, maybe it could be added to the  
examples section of the nc(1) man page ?


Reply | Threaded
Open this post in threaded view

Re: netcat man page: -e emulation

John Wright-6
How about

nc -l localhost 1234 |&
exec 0<&p 1>&p
# Rest of the script here.

This syntax is pretty new to me so I'm not sure of pros and cons.