Server script without built-in sockets
Kurt Granroth
kurt+plug-discuss at granroth.com
Mon Oct 22 18:21:49 MST 2007
Here's an esoteric question for those of you wanting a challenge. How
can I turn an arbitrary non-networked bash script into a server?
Okay, I'll head a followup question off at the pass... "why would I want
to do something insane like turning a bash script into a network
server?" The answer is "because". Really, there's no reason other than
I want to :-P
Now netcat handily has the exact option that I need: -e. With that, I
could do something like:
while 1; do netcat -l -p 16789 -e myscript.sh; done
Alas, the netcat people are reasonable and security conscious folk so
they prudently refuse to enable the -e option by default. In fact, to
get that functionality, you must recompile netcat with the
-DGAPING_SECURITY_HOLE compile flag! I love it :)
But that doesn't help me because the solution that *I* want would
require only software that I can reasonably assume would already be on
any Linux system (no compiling!).
I suppose I could write a couple line perl script to handle the incoming
connections... but it seems sacrilegious for a shell script to require
perl. Plus, not all Linux systems have perl.
[x]inted would certainly fit the bill but using that requires root
access so that's out.
Am I out of luck, here? Or is there some commonly available utility out
there that can open up a socket for me?
Kurt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 249 bytes
Desc: OpenPGP digital signature
Url : http://lists.PLUG.phoenix.az.us/pipermail/plug-discuss/attachments/20071022/0dbaf651/attachment.pgp
More information about the PLUG-discuss
mailing list