LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Script listening on TCP port (http://www.linuxquestions.org/questions/linux-networking-3/script-listening-on-tcp-port-494800/)

pcmilhouse 10-23-2006 06:12 AM

Script listening on TCP port
 
Can someone post a simple bash script listening on a TCP port?

How can I read tcp packet in bash?

Thanks

unSpawn 10-23-2006 09:02 AM

// This should be in the Programming forum IMHO.
Can someone post a simple bash script listening on a TCP port?
"GET", OK, "listen", no. At least I can't in pure shell. I know there's some toolkits to do server-client things in Bash but they're *way ancient*: look for Socketd (wzk@quietsche-entchen.de) or Socket (mark@eskimo.com). For both this and the question below explaining why you need it would be cool. Verbosity may lead to us giving suggestions or solutions that better match your task or situation.


How can I read tcp packet in bash?
Bash has no concept of "packets" or how to "read" them.
You want to resort to using a legitimate sniffer.

basileus 10-24-2006 01:15 PM

Try writing a bash script that uses "tcpdump" to capture the packet(s) you want. Google for "Bash for beginners" and "Advanced bash scripting guide". Also check out "man tcpdump" and you're set to go.


All times are GMT -5. The time now is 02:56 PM.