From ecb16767e853179bc00391afdafa73f0dcb505c3 Mon Sep 17 00:00:00 2001 From: david Date: Sat, 9 Feb 2013 19:08:05 +0000 Subject: [PATCH] Skip privileged pings against localhost on Windows. Compare to this similar test in Nmap's scan_engine.cc: if (scantype != CONNECT_SCAN && Targets[0]->ifType() == devt_loopback) { log_write(LOG_STDOUT, "Skipping %s against %s because Windows does not support scanning your own machine (localhost) this way.\n", scantype2str(scantype), Targets[0]->NameIP()); return; } rndbit made a report--unfortunately we con't fix it, but we can make the error message clearer. http://seclists.org/nmap-dev/2013/q1/187 --- CHANGELOG | 4 ++++ nping/NpingTargets.cc | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index e4e132a6f..d5bb31ef5 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,9 @@ # Nmap Changelog ($Id$); -*-text-*- +o [Nping] Nping now skips localhost targets for privileged pings (with + an error message) because those generally don't work. + [David Fifield] + o [Ncat] Ncat now keeps running in connect mode after receiving EOF from the remote socket, unless --recv-only is in effect. [Tomas Hozza] diff --git a/nping/NpingTargets.cc b/nping/NpingTargets.cc index 5d33e7d21..7e69cf0fd 100644 --- a/nping/NpingTargets.cc +++ b/nping/NpingTargets.cc @@ -277,7 +277,13 @@ int NpingTargets::processSpecs(){ delete mytarget; continue; } - +#ifdef WIN32 + if (rnfo.ii.device_type == devt_loopback){ + outError(QT_2, "Skipping %s because Windows does not allow localhost scans (try --unprivileged).", mytarget->getTargetIPstr() ); + delete mytarget; + continue; + } +#endif /* Determine next hop */ if( rnfo.direct_connect ){ mytarget->setDirectlyConnected(true);