Emulating netcat -e Emulating netcat -e linux linux

Emulating netcat -e


mkfifo foonc -lk 2600 0<foo | /bin/bash 1>foo

Then just nc servername 2600 and ./script.sh

kill the client with ctrl+c


The best way is to switch to the version of netcat that does support it. On Debian/Ubuntu IIRC correctly you should use netcat traditional, not netcat openbsd:

 sudo apt-get install netcat-traditional # netcat-openbsd

You will have the option of specifying explicitely which version you require:

 nc.traditional server 6767 -e myscript.sh nc.openbsd -l 6767

(note the subtle differences in option usage). As you can see (below) nc.traditional can be run as a standalone binary, depending on only libc and linux itself, so if you don't have installation permissions, you should be able to just drop the standalone binary somewhere (a filesystem with exec permission of course) and run it like

 /home/user/bin/mynetcat server 6767 -e myscript.sh

HTH


$ ldd `which nc.{traditional,openbsd}`/bin/nc.traditional:    linux-gate.so.1 =>  (0xb7888000)    libc.so.6 => /lib/libc.so.6 (0xb7709000)    /lib/ld-linux.so.2 (0xb7889000)/bin/nc.openbsd:    linux-gate.so.1 =>  (0xb77d0000)    libglib-2.0.so.0 => /lib/libglib-2.0.so.0 (0xb76df000)    libc.so.6 => /lib/libc.so.6 (0xb7582000)    libpcre.so.3 => /lib/libpcre.so.3 (0xb754c000)    /lib/ld-linux.so.2 (0xb77d1000)