As it has been pointed out by the link, a right source is auditing events of the Windows Filtering Platform. We can output needed data with the following cmd-script:
@echo off
for /f "tokens=2 delims==" %%s in ('wmic os get LocalDateTime /value') do set datetime=%%s
auditpol /set /subcategory:{0CCE9225-69AE-11D9-BED3-505054503030} /failure:enable > nul
pause
wmic ntevent where "LogFile='security' AND EventCode = 5152 AND TimeGenerated > '%datetime%'" get InsertionStrings
auditpol /set /subcategory:{0CCE9225-69AE-11D9-BED3-505054503030} /failure:disable > nul
"{0CCE9225-69AE-11D9-BED3-505054503030}" is the GUID of an event "Filtering Platform Packet Drop", 5152 is it's code. At the pause
time run a program / program's action of interest and resume the script when a test finishes. Sample output:
InsertionStrings
{"504", "\device\harddiskvolume2\windows\system32\svchost.exe", "%%14592", "10.0
.0.254", "67", "255.255.255.255", "68", "17", "89509", "%%14610", "44"}
{"3348", "\device\harddiskvolume2\another\program.exe", "%%14593", "10.0.0.1", "
52006", "123.123.123.123", "80", "6", "89523", "%%14611", "48"}
With get Message /value
instead of get InsertionStrings
in wmic command, output is more informative but also much longer:
Message=The Windows Filtering Platform has blocked a packet.
Application Information:
Process ID: 3128
Application Name: \device\harddiskvolume2\path\to\program.exe
Network Information:
Direction: Outbound
Source Address: 10.0.0.1
Source Port: 50099
Destination Address: 1.2.3.4
Destination Port: 80
Protocol: 6
Filter Information:
Filter Run-Time ID: 69203
Layer Name: Connect
Layer Run-Time ID: 48
These are just excerpts from the security log, which are accessible in GUI too.