From b131ed23fa159dbceb2b33d27ac34b09519e39c3 Mon Sep 17 00:00:00 2001 From: david Date: Fri, 14 Dec 2007 09:53:42 +0000 Subject: [PATCH] Fix the message printed when a host is skipped, for example on Windows when attempting to scan localhost. It used to look like All 0 scanned ports on 127.0.0.1 are ("Are what?") Now it looks like 0 ports scanned on 127.0.0.1 --- CHANGELOG | 7 +++++++ output.cc | 36 ++++++++++++++++++++---------------- 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 95c162764..f15ffeb26 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,12 @@ # Nmap Changelog ($Id$); -*-text-*- +o Fixed an output problem that showed itself on Windows when attempting + to scan localhost, which is skipped. The problem looked like + All 0 scanned ports on 127.0.0.1 are + ("Are what?") Now it looks like + 0 ports scanned on 127.0.0.1 + Rob Nicholls reported the problem. + o Fixed a bug that prevented the --resume option from working on Windows. A symptom of the bug was an error message that looks like ..\utils.cc(996): CreateFileMapping(), file 'testresume', length 103, diff --git a/output.cc b/output.cc index b59b0dae7..57618bd7b 100644 --- a/output.cc +++ b/output.cc @@ -466,25 +466,29 @@ void printportoutput(Target *currenths, PortList *plist) { } if (numignoredports == plist->numports) { - log_write(LOG_PLAIN, - "%s %d scanned %s on %s %s ", - (numignoredports == 1)? "The" : "All", numignoredports, - (numignoredports == 1)? "port" : "ports", - currenths->NameIP(hostname, sizeof(hostname)), - (numignoredports == 1)? "is" : "are"); - if (plist->numIgnoredStates() == 1) { - log_write(LOG_PLAIN, statenum2str(plist->nextIgnoredState(PORT_UNKNOWN))); + if (numignoredports == 0) { + log_write(LOG_PLAIN, "0 ports scanned on %s\n", currenths->NameIP(hostname, sizeof(hostname))); } else { - prevstate = PORT_UNKNOWN; - while ((istate = plist->nextIgnoredState(prevstate)) != PORT_UNKNOWN) { - if (prevstate != PORT_UNKNOWN) log_write(LOG_PLAIN, " or "); - log_write(LOG_PLAIN, "%s (%d)", statenum2str(istate), plist->getStateCounts(istate)); - prevstate = istate; + log_write(LOG_PLAIN, + "%s %d scanned %s on %s %s ", + (numignoredports == 1)? "The" : "All", numignoredports, + (numignoredports == 1)? "port" : "ports", + currenths->NameIP(hostname, sizeof(hostname)), + (numignoredports == 1)? "is" : "are"); + if (plist->numIgnoredStates() == 1) { + log_write(LOG_PLAIN, statenum2str(plist->nextIgnoredState(PORT_UNKNOWN))); + } else { + prevstate = PORT_UNKNOWN; + while ((istate = plist->nextIgnoredState(prevstate)) != PORT_UNKNOWN) { + if (prevstate != PORT_UNKNOWN) log_write(LOG_PLAIN, " or "); + log_write(LOG_PLAIN, "%s (%d)", statenum2str(istate), plist->getStateCounts(istate)); + prevstate = istate; + } } + if(o.reason) + print_state_summary(plist, STATE_REASON_EMPTY); + log_write(LOG_PLAIN, "\n"); } - if(o.reason) - print_state_summary(plist, STATE_REASON_EMPTY); - log_write(LOG_PLAIN, "\n"); log_write(LOG_MACHINE,"Host: %s (%s)\tStatus: Up", currenths->targetipstr(), currenths->HostName());