1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 11:59:03 +00:00

Print the addresses that were resolved but not scanned in each scan

report. It looks like this.

$ ./nmap google.com -sn

Starting Nmap 5.30BETA1 ( http://nmap.org ) at 2010-05-10 23:57 MDT
Nmap scan report for google.com (66.102.7.99)
Host is up (0.073s latency).
Other addresses for google.com (not scanned): 66.102.7.104
rDNS record for 66.102.7.99: lax04s01-in-f99.1e100.net

This replaces the line

Hostname google.com resolves to 2 IPs. Only scanned 66.102.7.99
This commit is contained in:
david
2010-05-11 05:59:09 +00:00
parent 0be83cf063
commit 57238b7df5
2 changed files with 10 additions and 4 deletions

View File

@@ -217,7 +217,7 @@ int TargetGroup::parse_expr(const char * const target_expr, int af) {
struct sockaddr_in *sin = (struct sockaddr_in *) &ss;
sin->sin_family = AF_INET;
sin->sin_addr = addr;
memcpy(&sin->sin_addr, target->h_addr_list[count], sizeof(sin->sin_addr));
resolvedaddrs.push_back(ss);
count++;
}

View File

@@ -1305,9 +1305,15 @@ void write_host_header(Target *currenths) {
write_host_status(currenths, o.resolve_all);
if (currenths->TargetName() != NULL
&& currenths->resolved_addrs.size() > 1) {
log_write(LOG_PLAIN, "Hostname %s resolves to %u IPs. Only scanned %s\n",
currenths->TargetName(), (unsigned int) currenths->resolved_addrs.size(),
currenths->targetipstr());
std::list<struct sockaddr_storage>::iterator it;
log_write(LOG_PLAIN, "Other addresses for %s (not scanned):",
currenths->TargetName());
it = currenths->resolved_addrs.begin();
it++;
for (; it != currenths->resolved_addrs.end(); it++)
log_write(LOG_PLAIN, " %s", inet_ntop_ez(&*it, sizeof(*it)));
log_write(LOG_PLAIN, "\n");
}
/* Print reverse DNS if it differs. */
if (currenths->TargetName() != NULL