kaitoy / pcap4j

A Java library for capturing, crafting, and sending packets.
https://www.pcap4j.org/
Other
1.16k stars 309 forks source link

Support Npcap native mode on Windows #87

Closed hsluoyz closed 7 years ago

hsluoyz commented 7 years ago

Hi, I'm the author of Npcap. Thanks for using Npcap as the low-level capture library on Windows!

An issue I found is that the current Pcap4J doesn't support the Npcap native mode (Npcap DLLs will be installed in System32\Npcap instead of System32). The impact is that the user has to install Npcap with WinPcap Compatible Mode option checked to use it with Pcap4J. Otherwise, Pcap4J cannot find Npcap DLLs. And enabling this option will install another copy of Npcap driver that is compatible with WinPcap (and together installing the DLLs to System32), which may affect the performance. So Npcap suggests all its downstream software to support Npcap native mode.

One of the advantages of fully supporting Npcap is that you can maintain the same Libpcap interface on different platforms like Linux, Windows. Because Npcap supports latest Libpcap 1.8.1 API. WinPcap only uses the deprecated Libpcap 1.0.0. Not to mention other features Npcap provides like the loopback interface and the native Wi-Fi capture, etc.

Now software like Wireshark, Nmap, SharpPcap (a C# wrapper for WinPcap/Npcap) has already supported Npcap native mode. So I would like to know if you wants to add this feature. Please refer to the docs here for details and implementation guidelines.

kaitoy commented 7 years ago

I think I can support the native mode easily. I will do it soon.

hsluoyz commented 7 years ago

Thanks!