From 8605dea33acc1aef9f8a9389342a3ab4bbd75a9f Mon Sep 17 00:00:00 2001 From: dmiller Date: Thu, 8 Nov 2018 15:28:13 +0000 Subject: [PATCH] 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. --- nmap.cc | 2 -- 1 file changed, 2 deletions(-) diff --git a/nmap.cc b/nmap.cc index 99187e1b3..14c9edcab 100644 --- a/nmap.cc +++ b/nmap.cc @@ -479,7 +479,6 @@ void validate_scan_lists(scan_lists &ports, NmapOps &o) { o.pingtype |= PINGTYPE_TCP_USE_SYN; } -#ifndef WIN32 /* Win32 has perfectly fine ICMP socket support */ if (!o.isr00t) { if (o.pingtype & (PINGTYPE_ICMP_PING | PINGTYPE_ICMP_MASK | PINGTYPE_ICMP_TS)) { 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) { } } } -#endif } struct ftpinfo ftp = get_default_ftpinfo();