mirror of
https://github.com/nmap/nmap.git
synced 2025-12-07 13:11:28 +00:00
Fixed a bunch of script errors reported by Duarte Silva:
http://seclists.org/nmap-dev/2012/q1/246
This commit is contained in:
@@ -119,7 +119,7 @@ local function dnsDiscover()
|
|||||||
if ( status and response[1] ) then
|
if ( status and response[1] ) then
|
||||||
return true, { name = name, ip = response[1] }
|
return true, { name = name, ip = response[1] }
|
||||||
end
|
end
|
||||||
until( not(d:match("%.")) )
|
until( not(d) or not(d:match("%.")) )
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -41,7 +41,10 @@ local geoplugin = function(ip)
|
|||||||
|
|
||||||
local output = {}
|
local output = {}
|
||||||
table.insert(output, "coordinates (lat,lon): "..loc.geoplugin_latitude..","..loc.geoplugin_longitude)
|
table.insert(output, "coordinates (lat,lon): "..loc.geoplugin_latitude..","..loc.geoplugin_longitude)
|
||||||
table.insert(output,"state: ".. loc.geoplugin_regionName..", ".. loc.geoplugin_countryName)
|
-- The JSON response for regionName contains a null sometimes which is represented
|
||||||
|
-- as a table by the library.
|
||||||
|
local regionName = ("table" == type(loc.geoplugin_regionName)) and "Unknown" or loc.geoplugin_regionName
|
||||||
|
table.insert(output,"state: ".. regionName ..", ".. loc.geoplugin_countryName)
|
||||||
|
|
||||||
return output
|
return output
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ local function cmdReq(host, port, url, result)
|
|||||||
result[item] = { name = name, value = val }
|
result[item] = { name = name, value = val }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return result
|
return true, result
|
||||||
end
|
end
|
||||||
|
|
||||||
action = function(host, port)
|
action = function(host, port)
|
||||||
@@ -121,7 +121,11 @@ action = function(host, port)
|
|||||||
|
|
||||||
local result
|
local result
|
||||||
for _, u in ipairs(urls) do
|
for _, u in ipairs(urls) do
|
||||||
result = cmdReq(host, port, u, result)
|
status, result = cmdReq(host, port, u, result)
|
||||||
|
end
|
||||||
|
|
||||||
|
if ( not(result) or not(next(result)) ) then
|
||||||
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
local output = tab.new(2)
|
local output = tab.new(2)
|
||||||
|
|||||||
Reference in New Issue
Block a user