Skip to content

Commit 8605dea

Browse files
committed
Fall back to TCP connect ping on Windows without pcap
While Windows raw sockets can send and receive ICMP packets, Nmap relies on libpcap packet capture to spot responses, so if pcap isn't available (--unprivileged or Npcap not installed), we need to fall back to TCP connect for host discovery, just like we do for unprivileged users on other operating systems. Previous behavior was a fatal error suggesting unhelpfully to use --unprivileged.
1 parent 66eee93 commit 8605dea

File tree

1 file changed

+0
-2
lines changed

1 file changed

+0
-2
lines changed

nmap.cc

-2
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,6 @@ void validate_scan_lists(scan_lists &ports, NmapOps &o) {
479479
o.pingtype |= PINGTYPE_TCP_USE_SYN;
480480
}
481481

482-
#ifndef WIN32 /* Win32 has perfectly fine ICMP socket support */
483482
if (!o.isr00t) {
484483
if (o.pingtype & (PINGTYPE_ICMP_PING | PINGTYPE_ICMP_MASK | PINGTYPE_ICMP_TS)) {
485484
error("Warning: You are not root -- using TCP pingscan rather than ICMP");
@@ -490,7 +489,6 @@ void validate_scan_lists(scan_lists &ports, NmapOps &o) {
490489
}
491490
}
492491
}
493-
#endif
494492
}
495493

496494
struct ftpinfo ftp = get_default_ftpinfo();

0 commit comments

Comments
 (0)