mirror of
https://github.com/nmap/nmap.git
synced 2026-01-27 16:49:01 +00:00
Write an "Nmap scan report" heading before scan results. It includes the
reverse DNS if it differs from the forward hostname.
This commit is contained in:
2
nmap.cc
2
nmap.cc
@@ -1893,7 +1893,7 @@ int nmap_main(int argc, char *argv[]) {
|
||||
log_write(LOG_XML, "<host starttime=\"%lu\" endtime=\"%lu\">",
|
||||
(unsigned long) currenths->StartTime(),
|
||||
(unsigned long) currenths->EndTime());
|
||||
write_host_status(currenths, o.resolve_all);
|
||||
write_host_header(currenths);
|
||||
if (currenths->timedOut(NULL)) {
|
||||
log_write(LOG_PLAIN,"Skipping host %s due to host timeout\n",
|
||||
currenths->NameIP(hostname, sizeof(hostname)));
|
||||
|
||||
16
output.cc
16
output.cc
@@ -626,9 +626,6 @@ void printportoutput(Target * currenths, PortList * plist) {
|
||||
log_write(LOG_PLAIN, "Scanned at %s for %lds\n",
|
||||
tbufs, tm_sece - tm_secs);
|
||||
}
|
||||
log_write(LOG_PLAIN, "Interesting %s on %s:\n",
|
||||
(o.ipprotscan) ? "protocols" : "ports",
|
||||
currenths->NameIP(hostname, sizeof(hostname)));
|
||||
log_write(LOG_MACHINE, "Host: %s (%s)", currenths->targetipstr(),
|
||||
currenths->HostName());
|
||||
|
||||
@@ -1423,6 +1420,19 @@ static char *num_to_string_sigdigits(double d, int digits) {
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
||||
/* Writes a heading for a full scan report ("Nmap scan report for..."),
|
||||
including host status and DNS records. */
|
||||
void write_host_header(Target *currenths) {
|
||||
log_write(LOG_PLAIN, "Nmap scan report for %s\n", currenths->NameIP());
|
||||
write_host_status(currenths, o.resolve_all);
|
||||
/* Print reverse DNS if it differs. */
|
||||
if (currenths->TargetName() != NULL
|
||||
&& strcmp(currenths->TargetName(), currenths->HostName()) != 0) {
|
||||
log_write(LOG_PLAIN, "rDNS record for %s: %s\n",
|
||||
currenths->targetipstr(), currenths->HostName());
|
||||
}
|
||||
}
|
||||
|
||||
/* Writes host status info to the log streams (including STDOUT). An
|
||||
example is "Host: 10.11.12.13 (foo.bar.example.com)\tStatus: Up\n" to
|
||||
|
||||
4
output.h
4
output.h
@@ -178,6 +178,10 @@ void output_ports_to_machine_parseable_output(struct scan_lists *ports,
|
||||
requested and the ports which it will scan for */
|
||||
void output_xml_scaninfo_records(struct scan_lists *ports);
|
||||
|
||||
/* Writes a heading for a full scan report ("Nmap scan report for..."),
|
||||
including host status and DNS records. */
|
||||
void write_host_header(Target *currenths);
|
||||
|
||||
/* Writes host status info to the log streams (including STDOUT). An
|
||||
example is "Host: 10.11.12.13 (foo.bar.example.com)\tStatus: Up\n" to
|
||||
machine log. resolve_all should be passed nonzero if the user asked
|
||||
|
||||
Reference in New Issue
Block a user