mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 21:21:31 +00:00
Changes the port type returned from url.parse() to an actual integer, as
opposed to a string that represents an integer. Fixes #833, fixes #817.
This commit is contained in:
@@ -1,5 +1,9 @@
|
|||||||
# Nmap Changelog ($Id$); -*-text-*-
|
# Nmap Changelog ($Id$); -*-text-*-
|
||||||
|
|
||||||
|
o [NSE][GH#833] Function url.parse() now returns the port part as a number,
|
||||||
|
not a string, which eliminates various inconsistencies in scripts that
|
||||||
|
consume the function. [nnposter]
|
||||||
|
|
||||||
o [NSE][GH#854] New script smb-double-pulsar-backdoor detects the Shadow
|
o [NSE][GH#854] New script smb-double-pulsar-backdoor detects the Shadow
|
||||||
Brokers-leaked Double Pulsar backdoor in Windows SMB servers. [Andrew Orr]
|
Brokers-leaked Double Pulsar backdoor in Windows SMB servers. [Andrew Orr]
|
||||||
|
|
||||||
|
|||||||
@@ -175,9 +175,9 @@ local function url_build_defaults (host, port, parsed)
|
|||||||
local parts = tcopy(parsed or {})
|
local parts = tcopy(parsed or {})
|
||||||
parts.host = parts.host or stdnse.get_hostname(host, port)
|
parts.host = parts.host or stdnse.get_hostname(host, port)
|
||||||
parts.scheme = parts.scheme or shortport.ssl(host, port) and "https" or "http"
|
parts.scheme = parts.scheme or shortport.ssl(host, port) and "https" or "http"
|
||||||
local pn = parts.port or tostring(port.number)
|
local pn = parts.port or port.number
|
||||||
if not (parts.scheme == "http" and pn == "80"
|
if not (parts.scheme == "http" and pn == 80
|
||||||
or parts.scheme == "https" and pn == "443") then
|
or parts.scheme == "https" and pn == 443) then
|
||||||
parts.port = pn
|
parts.port = pn
|
||||||
end
|
end
|
||||||
return parts
|
return parts
|
||||||
|
|||||||
@@ -1504,7 +1504,7 @@ local redirect_ok_rules = {
|
|||||||
url_port = 443
|
url_port = 443
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
if (not url_port) or tonumber(url_port) == port.number then
|
if not url_port or url_port == port.number then
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ Options = {
|
|||||||
local parsed_u = url.parse(tostring(u))
|
local parsed_u = url.parse(tostring(u))
|
||||||
|
|
||||||
if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then
|
if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then
|
||||||
if ( tonumber(parsed_u.port) ~= tonumber(o.base_url:getPort()) ) then
|
if ( parsed_u.port ~= tonumber(o.base_url:getPort()) ) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then
|
elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then
|
||||||
@@ -149,7 +149,7 @@ Options = {
|
|||||||
o.withindomain = function(u)
|
o.withindomain = function(u)
|
||||||
local parsed_u = url.parse(tostring(u))
|
local parsed_u = url.parse(tostring(u))
|
||||||
if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then
|
if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then
|
||||||
if ( tonumber(parsed_u.port) ~= tonumber(o.base_url:getPort()) ) then
|
if ( parsed_u.port ~= tonumber(o.base_url:getPort()) ) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then
|
elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then
|
||||||
@@ -553,7 +553,7 @@ Crawler = {
|
|||||||
iswithinhost = function(self, u)
|
iswithinhost = function(self, u)
|
||||||
local parsed_u = url.parse(tostring(u))
|
local parsed_u = url.parse(tostring(u))
|
||||||
if ( self.options.base_url:getPort() ~= 80 and self.options.base_url:getPort() ~= 443 ) then
|
if ( self.options.base_url:getPort() ~= 80 and self.options.base_url:getPort() ~= 443 ) then
|
||||||
if ( tonumber(parsed_u.port) ~= tonumber(self.options.base_url:getPort()) ) then
|
if ( parsed_u.port ~= tonumber(self.options.base_url:getPort()) ) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif ( parsed_u.scheme ~= self.options.base_url:getProto() ) then
|
elseif ( parsed_u.scheme ~= self.options.base_url:getProto() ) then
|
||||||
@@ -570,7 +570,7 @@ Crawler = {
|
|||||||
iswithindomain = function(self, u)
|
iswithindomain = function(self, u)
|
||||||
local parsed_u = url.parse(tostring(u))
|
local parsed_u = url.parse(tostring(u))
|
||||||
if ( self.options.base_url:getPort() ~= 80 and self.options.base_url:getPort() ~= 443 ) then
|
if ( self.options.base_url:getPort() ~= 80 and self.options.base_url:getPort() ~= 443 ) then
|
||||||
if ( tonumber(parsed_u.port) ~= tonumber(self.options.base_url:getPort()) ) then
|
if ( parsed_u.port ~= tonumber(self.options.base_url:getPort()) ) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
elseif ( parsed_u.scheme ~= self.options.base_url:getProto() ) then
|
elseif ( parsed_u.scheme ~= self.options.base_url:getProto() ) then
|
||||||
|
|||||||
@@ -183,8 +183,8 @@ function parse(url, default)
|
|||||||
if not authority then return parsed end
|
if not authority then return parsed end
|
||||||
authority = string.gsub(authority,"^([^@]*)@",
|
authority = string.gsub(authority,"^([^@]*)@",
|
||||||
function(u) parsed.userinfo = u; return "" end)
|
function(u) parsed.userinfo = u; return "" end)
|
||||||
authority = string.gsub(authority, ":([0-9]*)$",
|
authority = string.gsub(authority, ":(%d+)$",
|
||||||
function(p) if p ~= "" then parsed.port = p end; return "" end)
|
function(p) parsed.port = tonumber(p); return "" end)
|
||||||
if authority ~= "" then parsed.host = authority end
|
if authority ~= "" then parsed.host = authority end
|
||||||
local userinfo = parsed.userinfo
|
local userinfo = parsed.userinfo
|
||||||
if not userinfo then return parsed end
|
if not userinfo then return parsed end
|
||||||
|
|||||||
@@ -347,7 +347,7 @@ local function path_ok (path, hostname, port)
|
|||||||
if pparts.authority then
|
if pparts.authority then
|
||||||
if pparts.userinfo
|
if pparts.userinfo
|
||||||
or ( pparts.host ~= hostname )
|
or ( pparts.host ~= hostname )
|
||||||
or ( pparts.port and tonumber(pparts.port) ~= port.number ) then
|
or ( pparts.port and pparts.port ~= port.number ) then
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user