LazyWeb: Simple Unix TCP Proxy Debugging

OK LazyWeb. Help.

I need the ability to debug an arbitrary TCP connection. I have a server listening on port X. I want an app that can listen on Y and connect to port X forwarding all input/output between the two. All output would then be logged to a file.

This way I can temporarily tell my client to listen to port Y and then debug the network IO between them.

Ethereal and tcpdump will work but they’re a little bit overkill for this situation.

Netcat can do this but I can’t get it to both listen to a port and log to a non-hex format.

Any ideas?

Note: I used to use a home brewed Java app called plugproxy I wrote (extended actually) a few years ago but seem to have lost the source.


  1. Are you on a Mac? Interarchy has a pretty useful mode for this. EtherPeek is the pro tool, but it’s costlier.

  2. socat is awesome for the job. its netcat on steroids.

  3. or tcptunnel (but this doesn’t handle concurrent connections too well)

  4. I have a program I wrote called stp.c that’s a simple TCP proxy that can log either side of the communication (or both!). Sorry there’s very little documentation but it’s a simple C program so it should be easy to see how to use it (hmmm … looking at the code, you’ll need to specify the debug mode to use the logging, or change the code to suit your needs).






Follow

Get every new post delivered to your Inbox.