1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-23 22:59:20 +00:00

Give more information about possible causes and solutions when WinPcap fails to

load on Windows, in particular information about the NPF service and UAC.
This commit is contained in:
david
2010-01-15 05:39:25 +00:00
parent f21a07cfde
commit d541e795ba
2 changed files with 17 additions and 8 deletions

View File

@@ -337,10 +337,18 @@ bool NmapOps::RawScan() {
void NmapOps::ValidateOptions() {
const char *privreq = "root privileges";
const char *privreq = "root privileges.";
#ifdef WIN32
if (!o.have_pcap)
privreq = "that WinPcap version 3.1 or higher and iphlpapi.dll be installed. You seem to be missing one or both of these. Winpcap is available from http://www.winpcap.org. iphlpapi.dll comes with Win98 and later operating sytems and NT 4.0 with SP4 or greater. For previous windows versions, you may be able to take iphlpapi.dll from another system and place it in your system32 dir (e.g. c:\\windows\\system32)";
privreq = "WinPcap version 3.1 or higher and\n\
iphlpapi.dll. You seem to be missing one or both of these. Winpcap is\n\
available from http://www.winpcap.org. iphlpapi.dll comes with Win98 and\n\
later operating sytems and NT 4.0 with SP4 or greater. For previous windows\n\
versions, you may be able to take iphlpapi.dll from another system and place\n\
it in your system32 dir (e.g. c:\\windows\\system32).\n\
On Windows Vista and Windows 7, The WinPcap NPF service must be started by an\n\
administrator before WinPcap can be used. Running nmap.exe will open a UAC\n\
dialog where you can start NPF if you have administrator privileges.";
#endif
@@ -404,19 +412,19 @@ void NmapOps::ValidateOptions() {
if (!isr00t) {
if (ackscan|finscan|idlescan|ipprotscan|maimonscan|nullscan|synscan|udpscan|windowscan|xmasscan|sctpinitscan|sctpcookieechoscan) {
fatal("You requested a scan type which requires %s.", privreq);
fatal("You requested a scan type which requires %s", privreq);
}
if (numdecoys > 0) {
fatal("Sorry, but decoys (-D) require %s.", privreq);
fatal("Sorry, but decoys (-D) require %s", privreq);
}
if (fragscan) {
fatal("Sorry, but fragscan requires %s.", privreq);
fatal("Sorry, but fragscan requires %s", privreq);
}
if (osscan) {
fatal("TCP/IP fingerprinting (for OS scan) requires %s.", privreq);
fatal("TCP/IP fingerprinting (for OS scan) requires %s", privreq);
}
}

View File

@@ -153,8 +153,8 @@ static bool start_npf() {
goto quit_error;
}
if (!QueryServiceStatus(npf, &service)) {
goto quit_error;
error("Error in QueryServiceStatus");
goto quit_error;
}
npf_running = (service.dwCurrentState & SERVICE_RUNNING) != 0;
CloseServiceHandle(scm);
@@ -173,7 +173,8 @@ static bool start_npf() {
ret = (int) ShellExecute(0, "runas", "net.exe", "start npf", 0, SW_HIDE);
if (ret <= 32) {
error("Unable to start npf service: error code %d.", ret);
error("Unable to start NPF service: ShellExecute returned %d.\n\
Resorting to unprivileged (non-administrator) mode.", ret);
return false;
}