diff --git a/scripts/http-robtex-reverse-ip.nse b/scripts/http-robtex-reverse-ip.nse index d997054f0..acfc19a79 100644 --- a/scripts/http-robtex-reverse-ip.nse +++ b/scripts/http-robtex-reverse-ip.nse @@ -46,10 +46,12 @@ categories = {"discovery", "safe", "external"} -- @param data string containing the retrieved web page -- @return table containing the resolved host names function parse_robtex_response(data) - local data = string.gsub(data,"\r?\n","") + local data = data:match(".-(.-)") local result = {} - for href, link in string.gmatch(data,"
  • ([^\"^']-)
  • ") do - table.insert(result, link) + if data then + for domain in data:gmatch("
  • (.-)
  • ") do + table.insert(result, domain) + end end return result end @@ -64,8 +66,8 @@ action = function(host, port) return stdnse.format_output(false, "The argument \"http-robtex-reverse-ip.host\" did not contain a valid IPv4 address") end - local link = "https://www.robtex.com/ip/"..target..".html" - local htmldata = http.get_url(link) + local link = "/ip/"..target..".html" + local htmldata = http.get("www.robtex.com", 443, link) local domains = parse_robtex_response(htmldata.body) if ( #domains > 0 ) then return stdnse.format_output(true, domains) diff --git a/scripts/http-robtex-shared-ns.nse b/scripts/http-robtex-shared-ns.nse index e639ae77a..99e61cd90 100644 --- a/scripts/http-robtex-shared-ns.nse +++ b/scripts/http-robtex-shared-ns.nse @@ -48,12 +48,11 @@ function parse_robtex_response(data) end -- cut out the section we're interested in - data = data:match(".-(.-)") + data = data:match(".-(.-)") -- process each html list item if data then - for li in data:gmatch("
  • (.-)
  • ") do - local domain = li:match("(.*)") + for domain in data:gmatch("
  • (.-)
  • ") do if ( domain ) then table.insert(result, domain) end