Run procpcap from an Administrator prompt and this is what it prints. The stats line updates once a second until you press Ctrl+C. This is real output, from a capture of Firefox browsing for two and a half minutes on Windows 10.
PS> procpcap --name firefox -o procpcap-test.pcapng
seeded 13 existing flow(s) from the connection table.
0 pkt/s 0 B/s 27 endpoints entropy 5.70 (15148 packets)
capture stopped. 15148 packets written.
The first line is the seeding step: 13 flows Firefox already had open
when the capture began. Without it, those connections would be missed. The
stats line is the last one printed, after Ctrl+C. All 15,148 packets in
the file carry the comment pid 28988 firefox.exe: 11,634 IPv6
and 3,514 IPv4, to 28 addresses.
SNIFF | RECV_ONLY, reports which process owns each 5-tuple as connections open and close. A second handle sniffs IP packets at the network layer. A packet is written only when it matches a flow owned by a process you picked.LINKTYPE_RAW, because WinDivert delivers bare IP packets with no link-layer header. The owner goes in each packet’s comment, shown in Wireshark’s packet details pane. -w - streams the same format to stdout for wireshark -k -i -.examples\ is where to start.LINKTYPE_RAW, with pid <n> <name> in every packet’s commentprocpcap-v1.0.1-x64.zip: procpcap.exe, WinDivert.dll, WinDivert64.sys, WinDivert’s license and a Lua dissector template--pid)--name)--childrenLINKTYPE_RAW interface block-w -Intended use. procpcap is a diagnostic capture tool for your own machine and your own traffic: your own programs, single-player games, and the Handbook’s lab targets. It only reads packets. It does not modify, block or inject them. Capturing traffic you are not authorized to see may be illegal where you live. This is a research tool.
Administrator is required. WinDivert loads a kernel
driver, which needs an elevated prompt. procpcap says so and exits if it
is not elevated. WinDivert.dll and WinDivert64.sys
must sit next to procpcap.exe. The release zip puts them there.
The WinDivert driver can be blocked.
WinDivert64.sys is a signed but third-party driver. Antivirus
software flags it often. Windows can refuse to load it when Memory
Integrity (HVCI) or Smart App Control is on. If the driver will not load,
procpcap reports the error. You may have to allow the driver in your
security software, or turn those features off, to use it.
procpcap.exe itself is unsigned.
Build
it from source if you would rather not take a binary on trust.
What it does not do. It does not reassemble TCP streams;
that is Wireshark’s job once the file is open. It captures on the
local host only. Packets are written in the order procpcap attributes
them, not strictly in time order. In the Firefox capture above, the
largest step back was 25 ms. Run Wireshark’s reordercap
on the file if a tool needs it sorted.