1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-15 20:29:03 +00:00

Fix http.lua which ignores port.protocol and assumes it to be 'tcp' even if it is 'udp'.

Now http.request() returns nil if port.protocol is not 'tcp'.
Changed the portrule in html-title.nse to accept only TCP ports.

Fixed a redirect rule in html-title.nse which was comparing the string url.port with
the number port.number - which would always be false.
This commit is contained in:
jah
2008-11-10 22:55:08 +00:00
parent 9baccd2b04
commit c38aa90312
2 changed files with 6 additions and 2 deletions

View File

@@ -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