1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-31 20:09:02 +00:00

Re-indent some scripts. Whitespace-only commit

https://secwiki.org/w/Nmap/Code_Standards
This commit is contained in:
dmiller
2014-01-31 13:02:29 +00:00
parent 64fb5b3482
commit d36c08dcf5
137 changed files with 3977 additions and 3977 deletions

View File

@@ -45,46 +45,46 @@ prerule = function()
end
local addtargets = function(list)
local sum = 0
local sum = 0
for _, t in ipairs(list) do
local st, err = target.add(t)
if st then
sum = sum + 1
else
stdnse.print_debug("Couldn't add target " .. t .. ": " .. err)
end
end
for _, t in ipairs(list) do
local st, err = target.add(t)
if st then
sum = sum + 1
else
stdnse.print_debug("Couldn't add target " .. t .. ": " .. err)
end
end
return sum
return sum
end
action = function()
local hosts = stdnse.get_script_args("resolveall.hosts")
local hosts = stdnse.get_script_args("resolveall.hosts")
if type(hosts) ~= "table" then
hosts = {hosts}
end
if type(hosts) ~= "table" then
hosts = {hosts}
end
local sum, output = 0, {}
for _, host in ipairs(hosts) do
local status, list = nmap.resolve(host, nmap.address_family())
if status and #list > 0 then
if target.ALLOW_NEW_TARGETS then
sum = sum + addtargets(list)
end
table.insert(output,
string.format("Host '%s' resolves to:", host))
table.insert(output, list)
end
end
local sum, output = 0, {}
for _, host in ipairs(hosts) do
local status, list = nmap.resolve(host, nmap.address_family())
if status and #list > 0 then
if target.ALLOW_NEW_TARGETS then
sum = sum + addtargets(list)
end
table.insert(output,
string.format("Host '%s' resolves to:", host))
table.insert(output, list)
end
end
if sum > 0 then
table.insert(output,
string.format("Successfully added %d new targets",
tostring(sum)))
else
table.insert(output, "Use the 'newtargets' script-arg to add the results as targets")
end
return stdnse.format_output(true, output)
if sum > 0 then
table.insert(output,
string.format("Successfully added %d new targets",
tostring(sum)))
else
table.insert(output, "Use the 'newtargets' script-arg to add the results as targets")
end
return stdnse.format_output(true, output)
end