mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 04:31:29 +00:00
Include the reason why a host is down with --reason. It looks like this:
Nmap scan report for 1.2.3.4 [host down, received time-exceeded] Nmap scan report for 1.2.3.5 [host down, received no-response]
This commit is contained in:
10
output.cc
10
output.cc
@@ -1425,10 +1425,14 @@ static char *num_to_string_sigdigits(double d, int digits) {
|
||||
including host status and DNS records. */
|
||||
void write_host_header(Target *currenths) {
|
||||
if ((currenths->flags & HOST_UP) || o.verbose || o.resolve_all) {
|
||||
if (currenths->flags & HOST_UP)
|
||||
if (currenths->flags & HOST_UP) {
|
||||
log_write(LOG_PLAIN, "Nmap scan report for %s\n", currenths->NameIP());
|
||||
else if (currenths->flags & HOST_DOWN)
|
||||
log_write(LOG_PLAIN, "Nmap scan report for %s [host down]\n", currenths->NameIP());
|
||||
} else if (currenths->flags & HOST_DOWN) {
|
||||
log_write(LOG_PLAIN, "Nmap scan report for %s [host down", currenths->NameIP());
|
||||
if (o.reason)
|
||||
log_write(LOG_PLAIN, ", %s", target_reason_str(currenths));
|
||||
log_write(LOG_PLAIN, "]\n");
|
||||
}
|
||||
}
|
||||
write_host_status(currenths, o.resolve_all);
|
||||
if (currenths->TargetName() != NULL
|
||||
|
||||
@@ -357,7 +357,6 @@ void print_xml_state_summary(PortList *Ports, int state) {
|
||||
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));
|
||||
return reason;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user