星期三, 8月 11, 2010

[Linux] 如何sniffer 送出或是接受的protocol content.

在寫網路程式,常常需要處理protocol的問題,http要看header and content對不對,可是一直用Wireshark sniffer也是很煩,幸好linux可以用很簡單的方式看到~~~^^

mkfifo proxypipe
cat proxypipe | nc -l  11111 | tee -a inflow | nc localhost 11112 | tee -a outflow 1>proxypipe

可以把input放在inflow,把output放在outflow~~~~^^

好用呦~~~^^

來源出自
http://smaftoul.wordpress.com/2009/05/13/netcat-as-a-logging-tcp-proxy/