diff --git a/CHANGELOG b/CHANGELOG index a33ffd6ac..1d34e24f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,13 @@ # Nmap Changelog ($Id$); -*-text-*- +o Host status messages (up/down) are now uniform between ping scanning + and port scanning. They used to vary slighly, but now they all look + like + Host is up. + Host is down. + In addition, the reason for a host being up is now printed for port + scans just as for ping scans, with the --reason option. [David] + o [Zenmap] A typo that led to a crash if the ndiff subprocess terminated with an error was fixed. [David] The message was File "zenmapGUI\DiffCompare.pyo", line 331, in check_ndiff_process diff --git a/output.cc b/output.cc index 888c29e72..0aeff0e26 100644 --- a/output.cc +++ b/output.cc @@ -1326,7 +1326,6 @@ static void write_xml_initial_hostinfo(Target *currenths, for all hosts (even down ones) to be resolved */ void write_host_status(Target *currenths, int resolve_all) { char hostname[1200]; - char reasonbuf[512]; if (o.listscan) { /* write "unknown" to stdout, machine, and xml */ @@ -1356,42 +1355,21 @@ void write_host_status(Target *currenths, int resolve_all) { } } - else if (o.pingscan) { + else { /* Ping scan / port scan. */ - if(o.reason && currenths->flags & HOST_UP) - Snprintf(reasonbuf, 512, "%s.\n", target_reason_str(currenths)); - else - Snprintf(reasonbuf, 512, ".\n"); - write_xml_initial_hostinfo(currenths, (currenths->flags & HOST_UP)? "up" : "down"); - if (currenths->flags & HOST_UP) { - log_write(LOG_PLAIN,"Host %s appears to be up%s", currenths->NameIP(hostname, sizeof(hostname)), reasonbuf); - log_write(LOG_MACHINE,"Host: %s (%s)\tStatus: Up\n", currenths->targetipstr(), currenths->HostName()); - } else if (o.verbose || resolve_all) { - if (resolve_all) - log_write(LOG_PLAIN,"Host %s appears to be down.\n", currenths->NameIP(hostname, sizeof(hostname))); - else log_write(LOG_STDOUT,"Host %s appears to be down.\n", currenths->NameIP(hostname, sizeof(hostname))); - log_write(LOG_MACHINE, "Host: %s (%s)\tStatus: Down\n", currenths->targetipstr(), currenths->HostName()); - } - } - - else { /* Normal case (non ping/list scan or smurf address) */ - write_xml_initial_hostinfo(currenths, - (currenths->flags & HOST_UP)? "up" : "down"); - if (o.verbose) { + if (o.pingscan || o.verbose) { if (currenths->flags & HOST_UP) { - log_write(LOG_STDOUT, "Host %s appears to be up ... good.\n", - currenths->NameIP(hostname, sizeof(hostname))); - } else { - - if (resolve_all) { - log_write(LOG_PLAIN,"Host %s appears to be down, skipping it.\n", currenths->NameIP(hostname, sizeof(hostname))); - } - else { - log_write(LOG_STDOUT,"Host %s appears to be down, skipping it.\n", currenths->NameIP(hostname, sizeof(hostname))); - } - log_write(LOG_MACHINE, "Host: %s (%s)\tStatus: Down\n", currenths->targetipstr(), currenths->HostName()); + log_write(LOG_PLAIN, "Host %s is up", currenths->NameIP(hostname, sizeof(hostname))); + if (o.reason) + log_write(LOG_PLAIN, ", %s", target_reason_str(currenths)); + log_write(LOG_PLAIN, ".\n"); + log_write(LOG_MACHINE,"Host: %s (%s)\tStatus: Up\n", currenths->targetipstr(), currenths->HostName()); + } else if (o.verbose || resolve_all) { + log_write(resolve_all ? LOG_PLAIN : LOG_STDOUT, + "Host %s is down.\n", currenths->NameIP(hostname, sizeof(hostname))); + log_write(LOG_MACHINE, "Host: %s (%s)\tStatus: Down\n", currenths->targetipstr(), currenths->HostName()); } } } diff --git a/portreasons.cc b/portreasons.cc index 2014e2390..0c10f9dc8 100644 --- a/portreasons.cc +++ b/portreasons.cc @@ -356,7 +356,7 @@ char *target_reason_str(Target *t) { static char reason[128]; memset(reason,'\0', 128); assert(t->reason.reason_id != ER_NORESPONSE); - Snprintf(reason, 128, ", received %s",reason_str(t->reason.reason_id, SINGULAR)); + Snprintf(reason, 128, "received %s", reason_str(t->reason.reason_id, SINGULAR)); return reason; }