mirror of
https://github.com/nmap/nmap.git
synced 2026-02-15 09:56:33 +00:00
o [NSE] Modified the httpspider library to prefetch links in the queue and
change how script arguments are processed. Script and library arguments are now processed from within the library. [Patrik]
This commit is contained in:
@@ -38,31 +38,20 @@ portrule = shortport.http
|
||||
|
||||
function action(host, port)
|
||||
local EMAIL_PATTERN = "[A-Za-z0-9%.%%%+%-]+@[A-Za-z0-9%.%%%+%-]+%.%w%w%w?%w?"
|
||||
|
||||
-- by default, we cap the script at a maximum depth of 3
|
||||
local maxdepth = tonumber(stdnse.get_script_args("http-email-harvest.maxdepth")) or 3
|
||||
-- by default, we cap the script at a maximum pagecount of 20
|
||||
local maxpagecount = tonumber(stdnse.get_script_args("http-email-harvest.maxpagecount")) or 20
|
||||
|
||||
local url = stdnse.get_script_args("http-email-harvest.url") or "/"
|
||||
local withinhost = stdnse.get_script_args("http-email-harvest.withinhost")
|
||||
local withindomain = stdnse.get_script_args("http-email-harvest.withindomain")
|
||||
|
||||
local crawler = httpspider.Crawler:new(host, port, url or '/', {
|
||||
scriptname = SCRIPT_NAME
|
||||
}
|
||||
)
|
||||
|
||||
crawler:set_timeout(10000)
|
||||
|
||||
local maxdepth, maxpagecount = crawler.options.maxdepth, crawler.options.maxpagecount
|
||||
if ( maxdepth < 0 ) then maxdepth = nil end
|
||||
if ( maxpagecount < 0 ) then maxpagecount = nil end
|
||||
|
||||
stdnse.print_debug(2, "%s: Running crawler maxdepth: %s; maxpagecount: %s",
|
||||
SCRIPT_NAME, maxdepth or "[none]", maxpagecount or "[none]")
|
||||
|
||||
local crawler = httpspider.Crawler:new(host, port, url or '/', {
|
||||
maxdepth = maxdepth,
|
||||
maxpagecount = maxpagecount,
|
||||
withinhost = withinhost,
|
||||
withindomain= withindomain,
|
||||
}
|
||||
)
|
||||
|
||||
crawler:set_timeout(10000)
|
||||
|
||||
local emails = {}
|
||||
while(true) do
|
||||
|
||||
Reference in New Issue
Block a user