From 2564f0bf03da742b7dee74a882949894479b6a03 Mon Sep 17 00:00:00 2001 From: aca Date: Thu, 14 Jun 2012 17:19:03 +0000 Subject: [PATCH] added Daniel's patch --- scripts/dns-nsec3-enum.nse | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/scripts/dns-nsec3-enum.nse b/scripts/dns-nsec3-enum.nse index bc92c917a..84e8f4e73 100644 --- a/scripts/dns-nsec3-enum.nse +++ b/scripts/dns-nsec3-enum.nse @@ -216,16 +216,19 @@ local function query_for_hashes(host,subdomain,domain) local result local ranges = {} status, result = dns.query(subdomain, {host = host.ip, dtype='NSEC3', retAll=true, retPkt=true, dnssec=true}) - for _, nsec3 in ipairs(auth_filter(result, "NSEC3")) do - h1 = string.lower(remove_suffix(nsec3.dname,domain)) - h2 = string.lower(nsec3.hash.base32) - if not table_contains(all_results,"nexthash " .. h1 .. " " .. h2) then - table.insert(all_results, "nexthash " .. h1 .. " " .. h2) - stdnse.print_debug("nexthash " .. h1 .. " " .. h2) + if status then + for _, nsec3 in ipairs(auth_filter(result, "NSEC3")) do + h1 = string.lower(remove_suffix(nsec3.dname,domain)) + h2 = string.lower(nsec3.hash.base32) + if not table_contains(all_results,"nexthash " .. h1 .. " " .. h2) then + table.insert(all_results, "nexthash " .. h1 .. " " .. h2) + stdnse.print_debug("nexthash " .. h1 .. " " .. h2) + end + ranges[h1] = h2 end - ranges[h1] = h2 - end - + else + stdnse.print_debug(1, "DNS error: %s", result) + end return ranges end