mirror of
https://github.com/nmap/nmap.git
synced 2026-11-12 15:41:43 +00:00
Don't look for missing files in current directory; use fetchfile
This commit is contained in:
parent
257bcd1f7a
commit
c39d0e2e0a
4 changed files with 11 additions and 15 deletions
|
|
@ -312,11 +312,7 @@ local function load_fingerprints(filename, catlist, namelist)
|
|||
assert(type(cached_fingerprints) == "nil", "Unexpected cached fingerprints")
|
||||
|
||||
-- Try and find the file
|
||||
-- If it isn't in Nmap's directories, take it as a direct path
|
||||
filename_full = nmap.fetchfile('nselib/data/' .. filename)
|
||||
if(not(filename_full)) then
|
||||
filename_full = filename
|
||||
end
|
||||
filename_full = filename or nmap.fetchfile('nselib/data/http-default-accounts-fingerprints.lua')
|
||||
|
||||
-- Load the file
|
||||
stdnse.debug(1, "Loading fingerprints: %s", filename_full)
|
||||
|
|
@ -483,7 +479,6 @@ end
|
|||
|
||||
action = function(host, port)
|
||||
local fingerprint_filename = stdnse.get_script_args("http-default-accounts.fingerprintfile")
|
||||
or "http-default-accounts-fingerprints.lua"
|
||||
local catlist = stdnse.get_script_args("http-default-accounts.category")
|
||||
local namelist = stdnse.get_script_args("http-default-accounts.name")
|
||||
local basepath = stdnse.get_script_args("http-default-accounts.basepath") or "/"
|
||||
|
|
|
|||
|
|
@ -55,7 +55,9 @@ local function loadFingerprints(filename)
|
|||
local file, fingerprints
|
||||
|
||||
-- Find the file
|
||||
filename = nmap.fetchfile('nselib/data/' .. filename) or filename
|
||||
if not filename then
|
||||
filename = nmap.fetchfile('nselib/data/http-devframework-fingerprints.lua')
|
||||
end
|
||||
|
||||
-- Load the file
|
||||
stdnse.debug1("Loading fingerprints: %s", filename)
|
||||
|
|
@ -76,7 +78,7 @@ end
|
|||
|
||||
action = function(host, port)
|
||||
|
||||
local filename = stdnse.get_script_args("http-devframework.fingerprintfile") or "http-devframework-fingerprints.lua"
|
||||
local filename = stdnse.get_script_args("http-devframework.fingerprintfile")
|
||||
local tools = loadFingerprints(filename)
|
||||
if not tools then
|
||||
stdnse.debug1("Failed to load fingerprints")
|
||||
|
|
|
|||
|
|
@ -201,10 +201,7 @@ local function get_fingerprints(fingerprint_file, category)
|
|||
end
|
||||
|
||||
-- Try and find the file; if it isn't in Nmap's directories, take it as a direct path
|
||||
local filename_full = nmap.fetchfile('nselib/data/' .. fingerprint_file)
|
||||
if(not(filename_full)) then
|
||||
filename_full = fingerprint_file
|
||||
end
|
||||
local filename_full = fingerprint_file or nmap.fetchfile('nselib/data/http-fingerprints.lua')
|
||||
|
||||
stdnse.debug1("Loading fingerprint database: %s", filename_full)
|
||||
local env = setmetatable({fingerprints = {}}, {__index = _G})
|
||||
|
|
@ -369,7 +366,7 @@ action = function(host, port)
|
|||
-- Read the script-args, keeping the old ones for reverse compatibility
|
||||
local basepath = stdnse.get_script_args({'http-enum.basepath', 'path'}) or '/'
|
||||
local displayall = stdnse.get_script_args({'http-enum.displayall', 'displayall'}) or false
|
||||
local fingerprint_file = stdnse.get_script_args({'http-enum.fingerprintfile', 'fingerprints'}) or 'http-fingerprints.lua'
|
||||
local fingerprint_file = stdnse.get_script_args({'http-enum.fingerprintfile', 'fingerprints'})
|
||||
local category = stdnse.get_script_args('http-enum.category')
|
||||
-- local try_variations = stdnse.get_script_args({'http-enum.tryvariations', 'variations'}) or false
|
||||
-- local limit = tonumber(stdnse.get_script_args({'http-enum.limit', 'limit'})) or -1
|
||||
|
|
|
|||
|
|
@ -102,7 +102,9 @@ local function loadAuditRulebase( filename )
|
|||
test = function(t) table.insert(rules, t) end;
|
||||
}, {__index = _G})
|
||||
|
||||
filename = nmap.fetchfile("nselib/data/" .. filename) or filename
|
||||
if not filename then
|
||||
filename = nmap.fetchfile("nselib/data/mysql-cis.audit")
|
||||
end
|
||||
stdnse.debug(1, "Loading rules from: %s", filename)
|
||||
local file, err = loadfile(filename, "t", env)
|
||||
|
||||
|
|
@ -121,7 +123,7 @@ action = function( host, port )
|
|||
|
||||
local username = stdnse.get_script_args("mysql-audit.username")
|
||||
local password = stdnse.get_script_args("mysql-audit.password")
|
||||
local filename = stdnse.get_script_args("mysql-audit.filename") or "mysql-cis.audit"
|
||||
local filename = stdnse.get_script_args("mysql-audit.filename")
|
||||
|
||||
if ( not(username) ) then
|
||||
return fail("No username was supplied (see mysql-audit.username)")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue