-
Notifications
You must be signed in to change notification settings - Fork 853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarification of using npcap vs. libpcap when using MinGW/MSYS #1377
Comments
You will need Npcap. This project provides source code to a library that uses various mechanisms to perform packet capture and injection ("injection" because if the app is ping-like, it needs to inject packets, not just capture them.) It does not provide binary packages. On various UN*Xes, those mechanisms are provided by the operating system; there are several different mechanisms, and libpcap provides a common API, so that programs can work on multiple UN*X platforms without having to have their own code to use those mechanisms. The providers of those operating systems usually provide their own binary packages for libpcap, as part of the operating system. In the past, they didn't, and people would have to download the source code and compile it in order to use it. Windows, however, does not have a packet capture mechanism of the sort that UN*Xes have, so a group at the Politecnico di Torino wrote a driver that hooks into the Windows networking stack, and a library that uses that driver, and then added code to libpcap that uses that library. They released that as WinPcap. However, WinPcap development and support largely stopped; @hsluoyz took the code, wrote a new driver for newer versions of Windows, updated the libpcap code to the current version of libpcap, and that became Npcap. Npcap is now actively being developed and supported, primarily by @dmiller-nmap. The libpcap code they use is kept up-to-date with the released version of libpcap. It is possible to take Npcap's driver and library, install its SDK, and compile libpcap from this repository. The only reason to do so would be if either 1) you wanted to use code that hasn't been released yet, to get a bug fix or feature (note that features that are in the main branch but not in any release are subject to changes, including incompatible changes), or 2) you want to make your own modifications to libpcap. What you need to do is:
See the Npcap Developer's Guide for more information. |
In case it helps, at least some implementations of ping do the job using two layer 3 sockets, which may be possible on Windows, in which case you would not have to capture packets: ssend = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP);
srecv = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP); |
@infrastation That is true, but the resulting program must be run as Administrator. Raw sockets on Windows are deliberately limited. |
This is still very confusing and sounds completely backwards:
First you're telling me to install npcap, whiuch for me is exactl building and installing it, which is the origin of my trouble, as it depends on libpcap... :( Then you tell me to install the SDK (that AFAIKT is a dependency of (1).) |
30 days ban for verbal abuse. |
I'm using Cygwin and MinGW64/MSYS for compiling a ping-like app, which depends on
libpcap
.But I am confused whether I have to use this repo, or the Windows specific
npcap
one from here:https://github.com/nmap/npcap
Which one should I use?
What are the differences?
Would be great if you could update your README with this as well.
The text was updated successfully, but these errors were encountered: