I see your point, and just for fun, this
netcat script will work (for very particular values of 'work'):
Code:
#!/bin/sh
while true ; do
x=$(nc -l -q 0 -p 54321)
eval $x
done
54321 is the port number. To send a command to the server running this script, do this (or not, please):
Code:
user@linux:~$ echo <command> | nc -q 0 <IP_address_of_server> 54321
If the
<command> is
break, the server script will terminate.
Remember that
anyone with access to the network will:
a) be able to send
any command to your server, and
b) may be able to spy on the commands you're sending.
If you just want to run a limited set of commands, it would make more sense to send a simple number or identifier, and have the script interpret that as "run command X". It would vastly improve security too.