From 1588974594d14b462c2270a3969458ab7cd213e7 Mon Sep 17 00:00:00 2001 From: dmiller Date: Mon, 24 Oct 2016 20:17:09 +0000 Subject: [PATCH] Reduce verbosity of clock-skew script --- scripts/clock-skew.nse | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/scripts/clock-skew.nse b/scripts/clock-skew.nse index 1fb3e7308..3f1e732a3 100644 --- a/scripts/clock-skew.nse +++ b/scripts/clock-skew.nse @@ -93,12 +93,14 @@ hostaction = function(host) stddev = math.modf(stddev) median = math.modf(median) record_stats(host, mean, stddev, median) - local out = {mean = mean, stddev = stddev, median = median} - return out, ("mean: %s, deviation: %s, median: %s"):format( - stdnse.format_time(mean), - stdnse.format_time(stddev), - stdnse.format_time(median) - ) + if mean ~= 0 or stddev ~= 0 or nmap.verbosity() > 1 then + local out = {mean = mean, stddev = stddev, median = median} + return out, ("mean: %s, deviation: %s, median: %s"):format( + stdnse.format_time(mean), + stdnse.format_time(stddev), + stdnse.format_time(median) + ) + end end local function sorted_keys(t) @@ -159,7 +161,7 @@ postaction = function() local out = {} for mean, group in pairs(groups) do -- Collapse the biggest group - if #group > host_count // 2 then + if #groups > 1 and #group > host_count // 2 then out[stdnse.format_time(mean)] = "Majority of systems scanned" elseif #group > 1 then -- Only record groups of more than one system together