mirror of
https://github.com/nmap/nmap.git
synced 2025-12-06 12:41:29 +00:00
Fix "bad argument #1 to 'match' (string expected, got nil)" in hostrule
by returning early when nfs-ls and nfs-statfs do not have the required version numbers for the nfs and mountd ports.
This commit is contained in:
@@ -167,7 +167,13 @@ hostrule = function(host)
|
||||
end
|
||||
if mountport and nfsport then break end
|
||||
end
|
||||
if nfsport == nil then return false end
|
||||
-- Run when nfs and mount ports were scanned and their versions numbers known
|
||||
if not (nfsport and (host.registry.nfs.nfsver or nfsport.version.version)) then
|
||||
return false
|
||||
end
|
||||
if not (mountport and (host.registry.nfs.mountver or mountport.version.version)) then
|
||||
return false
|
||||
end
|
||||
if host.registry.nfs.nfsver == nil then
|
||||
local low, high = string.match(nfsport.version.version, "(%d)%-(%d)")
|
||||
if high == nil then
|
||||
@@ -185,7 +191,6 @@ hostrule = function(host)
|
||||
end
|
||||
end
|
||||
end
|
||||
if mountport == nil then return false end
|
||||
if host.registry.nfs.mountver == nil then
|
||||
local low, high = string.match(mountport.version.version, "(%d)%-(%d)")
|
||||
if high == nil then
|
||||
|
||||
@@ -68,7 +68,13 @@ hostrule = function(host)
|
||||
end
|
||||
if mountport and nfsport then break end
|
||||
end
|
||||
if nfsport == nil then return false end
|
||||
-- Run when nfs and mount ports were scanned and their versions numbers known
|
||||
if not (nfsport and (host.registry.nfs.nfsver or nfsport.version.version)) then
|
||||
return false
|
||||
end
|
||||
if not (mountport and (host.registry.nfs.mountver or mountport.version.version)) then
|
||||
return false
|
||||
end
|
||||
if host.registry.nfs.nfsver == nil then
|
||||
local low, high = string.match(nfsport.version.version, "(%d)%-(%d)")
|
||||
if high == nil then
|
||||
@@ -86,7 +92,6 @@ hostrule = function(host)
|
||||
end
|
||||
end
|
||||
end
|
||||
if mountport == nil then return false end
|
||||
if host.registry.nfs.mountver == nil then
|
||||
local low, high = string.match(mountport.version.version, "(%d)%-(%d)")
|
||||
if high == nil then
|
||||
|
||||
Reference in New Issue
Block a user