From 06a2c214a1397a335a03485759d80567e148833e Mon Sep 17 00:00:00 2001 From: nnposter Date: Wed, 10 Dec 2025 18:40:25 +0000 Subject: [PATCH] Check for a prefix, not a substring, and trivial cosmetics --- scripts/hostmap-crtsh.nse | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/hostmap-crtsh.nse b/scripts/hostmap-crtsh.nse index 36f05e745..679006004 100644 --- a/scripts/hostmap-crtsh.nse +++ b/scripts/hostmap-crtsh.nse @@ -98,18 +98,20 @@ local function query_ctlogs (hostname, lax_mode) stdnse.debug1("Error: Could not GET %s", url) return end + local jstatus, jresp = json.parse(response.body) if not jstatus then - stdnse.debug1("Error: Invalid response from %s", url) + stdnse.debug1("Error: Invalid JSON response from %s", url) return end + local hostnames = {} for _, cert in ipairs(jresp) do - local names = cert.name_value; + local names = cert.name_value if type(names) == "string" then for _, name in ipairs(stringaux.strsplit("%s+", names:lower())) do -- if this is a wildcard name, just proceed with the static portion - if name:find("*.", 1, true) == 1 then + if name:sub(1, 2) == "*." then name = name:sub(3) end if name ~= hostname and not hostnames[name] and is_valid_hostname(name) then