From 53ca0c01dd529ba279bdd03de11d9c040a23b733 Mon Sep 17 00:00:00 2001 From: devin Date: Wed, 28 May 2014 02:29:31 +0000 Subject: [PATCH] Added checks to prevent scripts from indexing a nill value when scanning localhost. --- nselib/shortport.lua | 2 +- scripts/http-robtex-shared-ns.nse | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/nselib/shortport.lua b/nselib/shortport.lua index bc9db6c8d..64ddfc3ab 100644 --- a/nselib/shortport.lua +++ b/nselib/shortport.lua @@ -197,7 +197,7 @@ local LIKELY_SSL_SERVICES = { -- @usage -- portrule = shortport.ssl function ssl(host, port) - return port.version.service_tunnel == "ssl" or + return (port.version and port.version.service_tunnel == "ssl") or port_or_service(LIKELY_SSL_PORTS, LIKELY_SSL_SERVICES, {"tcp", "sctp"})(host, port) end diff --git a/scripts/http-robtex-shared-ns.nse b/scripts/http-robtex-shared-ns.nse index 358a6ab83..065c8acb5 100644 --- a/scripts/http-robtex-shared-ns.nse +++ b/scripts/http-robtex-shared-ns.nse @@ -51,10 +51,12 @@ function parse_robtex_response(data) data = data:match(".-(.-)") -- process each html list item - for li in data:gmatch("
  • (.-)
  • ") do - local domain = li:match("(.*)") - if ( domain ) then - table.insert(result, domain) + if data then + for li in data:gmatch("
  • (.-)
  • ") do + local domain = li:match("(.*)") + if ( domain ) then + table.insert(result, domain) + end end end