diff --git a/nselib/http.lua b/nselib/http.lua index 779dce553..142392a01 100644 --- a/nselib/http.lua +++ b/nselib/http.lua @@ -123,6 +123,10 @@ request = function( host, port, data, options ) local protocol = 'tcp' if type(port) == 'table' then + if port.protocol and port.protocol ~= 'tcp' then + stdnse.print_debug(1, "http.request() supports the TCP protocol only, your request to %s cannot be completed.", host) + return nil + end if port.service == 'https' or ( port.version and port.version.service_tunnel == 'ssl' ) then protocol = 'ssl' end diff --git a/scripts/html-title.nse b/scripts/html-title.nse index c3b095562..c7d487e0d 100644 --- a/scripts/html-title.nse +++ b/scripts/html-title.nse @@ -27,7 +27,7 @@ local ipOps = require 'ipOps' local stdnse = require 'stdnse' portrule = function(host, port) - if not (port.service == 'http' or port.service == 'https') then + if port.protocol ~= 'tcp' or not (port.service == 'http' or port.service == 'https') then return false end -- Don't bother running on SSL ports if we don't have SSL. @@ -123,7 +123,7 @@ function redirect_ok(url, host, port) function (loc, url, host, port) -- if present, url.port must be the same as the scanned port -- loc.port must be set if returning true - if (not url.port) or url.port == port.number then + if (not url.port) or tonumber(url.port) == port.number then loc.port = port return true end