How to intercept socket traffic on solaris

debuggingsolaristcp

I'm not very familiar with Solaris, so maybe there are tools that I don't know about. I need to debug the communication between two components on the same machine, talking to each other using a normal TCP socket.

Now there seem to be two tools available, one known from linux called tcpdump, the other one being a solaris utility called snoop. Unfortunately, at the client's site, there are a lot of restrictions and whatnot, so using these tools is not allowed / possible.

So, what I figured is that I could change the listening port of the server process to something else and have a tool like netcat act as a proxy on the actual port while forwarding the traffic to the "real" server process, so I can dump the communication between those components.

Is there a tool that does this – preferably outputting a known format like tcpdump's? Or how else would you go about this?

Best Answer

snoop is not an option anyway because it won't work for traffic between two processes on the same host.

DTrace is your best bet. For example, here is a script for capturing traffic between two processes on the same server in snoop format. However, this particular script relies on the internal workings of the kernel so it may or may not work with your version of Solaris 10.