1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Allowed absolute paths to 'hostnames' argument.

This commit is contained in:
sophron
2013-07-18 13:51:11 +00:00
parent b14d393918
commit 9c6d376bfc

View File

@@ -137,6 +137,14 @@ local testThread = function(result, host, port, name)
condvar "signal" condvar "signal"
end end
local readFromFile = function(filename)
local database = {}
for l in io.lines(filename) do
table.insert(database, l)
end
return database
end
portrule = shortport.http portrule = shortport.http
--- ---
@@ -144,13 +152,18 @@ portrule = shortport.http
-- @param host table -- @param host table
-- @param port table -- @param port table
action = function(host, port) action = function(host, port)
local result, threads = {}, {} local result, threads, hostnames = {}, {}, {}
local condvar = nmap.condvar(result) local condvar = nmap.condvar(result)
local status
local status, hostnames = datafiles.parse_file(arg_filelist or "nselib/data/vhosts-default.lst" , {}) if arg_filelist then
if not status then hostnames = readFromFile(arg_filelist)
stdnse.print_debug(1, "Can not open file with vhosts file names list") else
return status, hostnames = datafiles.parse_file("nselib/data/vhosts-default.lst" , {})
if not status then
stdnse.print_debug(1, "Can not open file with vhosts file names list")
return
end
end end
arg_domain = arg_domain or defineDomain(host) arg_domain = arg_domain or defineDomain(host)