//View Tip #33
Similar Tips
» Disable bash history
» network copy with ssh and tar
» Local/remote webserver
» Transfer files with netcat
» Permanent bash history


Latest tips by RSS
Click here to subscribe
Follow Shell-Fu on Twitter
Click here to follow
Follow Shell-Fu on identi.ca
Click here to follow
mknod backpipe p; while nc -l -p 80 0<backpipe | tee -a inflow | \
nc localhost 81 | tee -a outflow 1>backpipe; do echo \"restarting\"; done

Listen on localhost:80, forward to localhost:81 and log both sides of the conversation to outflow, automatically restarting if the connection dies.

View Comments »


Add your comment

Comments are currently disabled
socat -v TCP4-LISTEN:80 TCP4:localhost:81 will do the same and is way more readable
Posted 2009-04-03 08:22:59
George Avasar
If I get it, which I might not, you're creating a fifo device and using netcat to port forward traffic from port 80/tcp to port 81/tcp, and you want to see the traffic too.

How does that relate to you title? Wireshark can't port forward.

As for zod's comment...well, I think your on the right track using nc.  It's installed everywhere and a tip that needs you to install socat wouldn't be as useful.
Posted 2010-09-19 12:42:35

Home Latest Browse Top 25 Random Hall Of Fame Contact Submit