I have this script on my netcat server which asks for name and some other information:
*echo "Tell me your name" read $ln echo "I got '$ln'" echo "Tell me something more" while read ln; do echo "I got '$ln'" echo "Tell me something more" done*
When a client connects to this server, I want the script to communicate with the client directly.
On server end I do :
while true; do nc -l -p port-no | ./My-script-file ; done
The while loop is just so that the server continues listening even after one client has closed the connection and nothing else. But somehow, I cannot get the queries to appear on client side.
On client side I do:
nc server-ip port-no
I want the lines "Tell me your name", "I got..." and "Tell me something else" to appear on client screen and the input from client end to be fed into the script.
I have also tried options like
--sh-exec and the errors I am getting are something like
nc: invalid option -- '-' usage: nc [-46CDdFhklNnrStUuvZz] [-I length] [-i interval] [-M ttl] [-m minttl] [-O length] [-P proxy_username] [-p source_port] [-q seconds] [-s source] [-T keyword] [-V rtable] [-W recvlimit] [-w timeout] [-X proxy_protocol] [-x proxy_address[:port]] [destination] [port]