From 4e117783a10a865fdb1c6bf12b34fe54774f9ec1 Mon Sep 17 00:00:00 2001 From: david Date: Mon, 8 Jun 2009 23:42:57 +0000 Subject: [PATCH] With --version-trace, show the names of probes as they are sent. Also show the names of probes that had a match with --version-trace (used to only happen with -d2). The patch is from Tom Sellers. --- CHANGELOG | 3 +++ service_scan.cc | 9 +++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 9e2c23653..74192a3bb 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,8 @@ # Nmap Changelog ($Id$); -*-text-*- +o The --version-trace option now shows the names of the probes as they + are sent. The patch was from Tom Sellers. + o [Ncat] SSL in listen mode was made to work on systems like BSD in which a socket inherits its blocking of non-blocking status from the listening socket. Thanks to Daniel Roethlisberger for reporting the diff --git a/service_scan.cc b/service_scan.cc index 25244806e..2421b2cd1 100644 --- a/service_scan.cc +++ b/service_scan.cc @@ -1719,6 +1719,11 @@ static void adjustPortStateIfNeccessary(ServiceNFO *svc) { const u8 *probestring; int probestringlen; + // Report data as probes are sent if --version-trace has been requested + if (o.debugging > 1 || o.versionTrace()) { + log_write(LOG_PLAIN, "Service scan sending probe %s to %s:%hu (%s)\n", probe->getName(), svc->target->targetipstr(), svc->portno, proto2ascii(svc->proto)); + } + assert(probe); if (probe->isNullProbe()) return 0; // No need to send anything for a NULL probe; @@ -2144,12 +2149,12 @@ static void servicescan_read_handler(nsock_pool nsp, nsock_event nse, void *myda // WOO HOO!!!!!! MATCHED! But might be soft if (MD->isSoft && svc->probe_matched) { if (strcmp(svc->probe_matched, MD->serviceName) != 0) - error("WARNING: service %s:%hu had allready soft-matched %s, but now soft-matched %s; ignoring second value", svc->target->NameIP(), svc->portno, svc->probe_matched, MD->serviceName); + error("WARNING: service %s:%hu had already soft-matched %s, but now soft-matched %s; ignoring second value", svc->target->NameIP(), svc->portno, svc->probe_matched, MD->serviceName); // No error if its the same - that happens frequently. For // example, if we read more data for the same probe response // it will probably still match. } else { - if (o.debugging > 1) { + if (o.debugging > 1 || o.versionTrace()) { if (MD->product || MD->version || MD->info) log_write(LOG_PLAIN, "Service scan match (Probe %s matched with %s): %s:%hu is %s%s. Version: |%s|%s|%s|\n", probe->getName(), (*probe->fallbacks[fallbackDepth]).getName(),