Nmap Development mailing list archives
Re: [nmap-svn] r31337 - nmap-exp/sophron/extended-httpspider/nselib
From: Fyodor <fyodor () nmap org>
Date: Sun, 28 Jul 2013 23:28:50 -0700
On Fri, Jul 12, 2013 at 4:24 PM, <commit-mailer () nmap org> wrote:
Author: sophron Date: Fri Jul 12 23:24:15 2013 New Revision: 31337 Log: I don't believe this condition is necessary. Modified: nmap-exp/sophron/extended-httpspider/nselib/httpspider.lua
David noticed that you got the big revision number 31337. Congratulations! And wow, that's a lot of revisions we've done since starting the repository way back in 1998. Cheers, Fyodor
Modified: nmap-exp/sophron/extended-httpspider/nselib/httpspider.lua ============================================================================== --- nmap-exp/sophron/extended-httpspider/nselib/httpspider.lua (original) +++ nmap-exp/sophron/extended-httpspider/nselib/httpspider.lua Fri Jul 12 23:24:15 2013 @@ -89,38 +89,36 @@ o.blacklist = o.blacklist or {} local removewww = function(url) return string.gsub(url, "^www%.", "") end - if ( o.withinhost == true or o.withindomain == true ) then - -- set up the appropriate matching functions - if ( o.withinhost ) then - o.withinhost = function(u) - local parsed_u = url.parse(tostring(u)) - - if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then - if ( tonumber(parsed_u.port) ~= tonumber(o.base_url:getPort()) ) then - return false - end - elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then - return false - -- if urls don't match only on the "www" prefix, then they are probably the same - elseif ( parsed_u.host == nil or removewww(parsed_u.host:lower()) ~= removewww(o.base_url:getHost():lower()) ) then + -- set up the appropriate matching functions + if ( o.withinhost ) then + o.withinhost = function(u) + local parsed_u = url.parse(tostring(u)) + + if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then + if ( tonumber(parsed_u.port) ~= tonumber(o.base_url:getPort()) ) then return false end - return true + elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then + return false + -- if urls don't match only on the "www" prefix, then they are probably the same + elseif ( parsed_u.host == nil or removewww(parsed_u.host:lower()) ~= removewww(o.base_url:getHost():lower()) ) then + return false end - else - o.withindomain = function(u) - local parsed_u = url.parse(tostring(u)) - if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then - if ( tonumber(parsed_u.port) ~= tonumber(o.base_url:getPort()) ) then - return false - end - elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then - return false - elseif ( parsed_u.host == nil or parsed_u.host:sub(-#o.base_url:getDomain()):lower() ~= o.base_url:getDomain():lower() ) then + return true + end + else + o.withindomain = function(u) + local parsed_u = url.parse(tostring(u)) + if ( o.base_url:getPort() ~= 80 and o.base_url:getPort() ~= 443 ) then + if ( tonumber(parsed_u.port) ~= tonumber(o.base_url:getPort()) ) then return false end - return true + elseif ( parsed_u.scheme ~= o.base_url:getProto() ) then + return false + elseif ( parsed_u.host == nil or parsed_u.host:sub(-#o.base_url:getDomain()):lower() ~= o.base_url:getDomain():lower() ) then + return false end + return true end end setmetatable(o, self) @@ -540,8 +538,9 @@ return true end, - isresource = function(url, extension, signs) - if string.match(url, "." .. extension .. "$") then + isresource = function(self, u, ext, signs) + + if string.match(u, "." .. ext .. "$") then return true end @@ -554,8 +553,8 @@ else signstring = "%?#" end - - return string.match(url, "." .. extension .. "[" .. signstring .. "]" .. "[^.]*$") + + return string.match(u, "." .. ext .. "[" .. signstring .. "]" .. "[^.]*$") end, _______________________________________________ Sent through the svn mailing list http://nmap.org/mailman/listinfo/svn
_______________________________________________ Sent through the dev mailing list http://nmap.org/mailman/listinfo/dev Archived at http://seclists.org/nmap-dev/
Current thread:
- Re: [nmap-svn] r31337 - nmap-exp/sophron/extended-httpspider/nselib Fyodor (Jul 28)
- Re: [nmap-svn] r31337 - nmap-exp/sophron/extended-httpspider/nselib George Chatzisofroniou (Jul 29)