I'm looking to capture all IP traffic on a Windows machine to/from all interfaces.
- I must be able to capture the process ID which generated the outgoing traffic.
- I need to be able to trigger capture from the command line and automatically parse the capture file in an external tool.
I'm trying to use netsh
, which appears to be able to do the job. However I'm having problems figuring out how to extract the information I need.
Running netsh trace start persistent=yes capture=yes tracefile=xxx
then netsh trace stop
seems to capture the information I need. If I load the generated .etl file into Windows Message Analyzer (WMA) then I can see IP traffic along with a lot of other event information
My specific problems are:
- How do I restrict
netsh
to only capture IP traffic? - How do I parse an etl file without a tool like WMA?
Regarding the second question. I've managed to convert the etl file to an xml file (using tracerpt
or netsh trace convert
. However the data seems to be incomplete. I can't see, for example, an IP address which I know traffic was sent to (confirmed in WMA). Possibly it's all hidden in some binary blob.
netsh
captures: Using Netsh to Manage Traces andnetsh trace show capturefilterHelp
.netsh
, using the command line. Asnetsh
is already a command line tool this is pretty easy. Your current approach is meant for debugging. If you try to monitor the server you'd usually go for a mirroring of traffic and send that traffic straight to the analyzer.parse.exe
. It probably won't do what you need though. How do you expect to automate the analysis if you need to supply information for that analysis? My guess is still that you're looking at the wrong kind of tool. Maybe try to include an actual example of what you would the workflow like to be and what kind of actions you're actually trying to perform and what kind of data you're interested in.