nmap / npcap

Nmap Project's Windows packet capture and transmission library
https://npcap.com
Other
2.97k stars 514 forks source link

Windows 7 (32/64bit) npcap 1.1 filter problem #282

Open cizekmilan opened 3 years ago

cizekmilan commented 3 years ago

Hi, i tested my sw based on Npcap and SharpPcap (C#) on some systems. Windows 10, Windows 8.1, all is OK. On Windows 7 32bit and Windows 7 64bit, I receive error Can't compile filter (https://snipboard.io/GjAdCh.jpg). When I unsintall npcap and install Winpcap instead, my program is working without errors.

guyharris commented 3 years ago

What is the code in your program that opens a device for capturing, and what is the code that compiles the filter?

cizekmilan commented 3 years ago

Here is my pseudocode...

`public SnifferBW(ICaptureDevice device, string Filter, delegProcessPacket processPacket, frmPacketDisplay packetDisplay, frmSettings fSettings) { ... try { device.Open(DeviceMode.Promiscuous, 1000); device.Filter = Filter; } catch (Exception e) {

}

... }

ICaptureDevice d;

for (int i = 0; i < checkedIndices.Length; i++) // iteration over network adapters { d = allDevices[checkedIndices[i]]; // d is device/adapter // every network card has own thread bws[i] = new SnifferBW(d, "ether multicast and ether dst 01:00:0c:cc:cc:cc", ProcessPacket, this, fSettings); ... }`

guyharris commented 3 years ago

So if device.Open() fails, that will throw an exception before device.Filter = Filter;, and will not try to set the filter?