mirror of
https://github.com/nmap/nmap.git
synced 2025-12-29 02:49:01 +00:00
Fix unpwdb.filter_iterator (http://seclists.org/nmap-dev/2015/q2/44)
This commit is contained in:
@@ -317,15 +317,17 @@ end
|
||||
-- @param filter Function that returns bool, which serves as a filter
|
||||
-- @return function The filtered iterator.
|
||||
function filter_iterator (iterator, filter)
|
||||
local function helper (...)
|
||||
if filter(...) then
|
||||
return ...
|
||||
return function (command)
|
||||
if command == "reset" then
|
||||
iterator "reset"
|
||||
else
|
||||
local val = iterator(command)
|
||||
while val and not filter(val) do
|
||||
val = iterator(command)
|
||||
end
|
||||
return val
|
||||
end
|
||||
end
|
||||
local function filter (command)
|
||||
return helper(iterator(command))
|
||||
end
|
||||
return filter
|
||||
end
|
||||
|
||||
return _ENV;
|
||||
|
||||
Reference in New Issue
Block a user