1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-07 13:11:28 +00:00

Some cleanup of issues by nnposter: Fixes #614, fixes #615, fixes #618

This commit is contained in:
dmiller
2016-12-18 05:01:40 +00:00
parent 1b92c92092
commit 6926b66859
3 changed files with 12 additions and 15 deletions

View File

@@ -15,28 +15,26 @@ _ENV = stdnse.module("geoip", stdnse.seeall)
-- @param lat The latitude in degrees -- @param lat The latitude in degrees
-- @param lon The longitude in degrees -- @param lon The longitude in degrees
add = function(ip, lat, lon) add = function(ip, lat, lon)
if not nmap.registry.geoip then
nmap.registry.geoip = {}
end
if not nmap.registry.geoip[ip] then
nmap.registry.geoip[ip] = {}
end
local lat_n = tonumber(lat) local lat_n = tonumber(lat)
if lat_n < -90 or lat_n > 90 then if not lat_n or lat_n < -90 or lat_n > 90 then
stdnse.debug1("Invalid latitude for %s: %s.", ip, lat) stdnse.debug1("Invalid latitude for %s: %s.", ip, lat)
return return
end end
local lon_n = tonumber(lon) local lon_n = tonumber(lon)
if lon_n < -180 or lon_n > 180 then if not lat_n or lon_n < -180 or lon_n > 180 then
stdnse.debug1("Invalid longitude for %s: %s.", ip, lon) stdnse.debug1("Invalid longitude for %s: %s.", ip, lon)
return return
end end
nmap.registry.geoip[ip]["latitude"] = lat if not nmap.registry.geoip then
nmap.registry.geoip[ip]["longitude"] = lon nmap.registry.geoip = {}
end
nmap.registry.geoip[ip] = {
latitude = lat,
longitude = lon
}
end end
--- Check if any coordinates have been stored in the registry --- Check if any coordinates have been stored in the registry

View File

@@ -26,7 +26,7 @@ Additional information for the Bing Maps REST Services API can be found at:
-- @args ip-geolocation-map-bing.api_key The required Bing Maps API key for your -- @args ip-geolocation-map-bing.api_key The required Bing Maps API key for your
-- account. An API key can be generated at https://www.bingmapsportal.com/ -- account. An API key can be generated at https://www.bingmapsportal.com/
-- --
-- ip-geolocation-map-bing.center GPS coordinates defining the center of the -- @args ip-geolocation-map-bing.center GPS coordinates defining the center of the
-- image. If omitted, Bing Maps will choose a center that shows all the -- image. If omitted, Bing Maps will choose a center that shows all the
-- markers. -- markers.
-- --

View File

@@ -26,7 +26,7 @@ Additional information for the Google Static Maps API can be found at:
-- your account. An API key can be generated at -- your account. An API key can be generated at
-- https://developers.google.com/maps/documentation/static-maps/." @args -- https://developers.google.com/maps/documentation/static-maps/." @args
-- --
-- ip-geolocation-map-google.center GPS coordinates defining the center of the -- @args ip-geolocation-map-google.center GPS coordinates defining the center of the
-- image. If omitted, Google Maps will choose a center that shows all the -- image. If omitted, Google Maps will choose a center that shows all the
-- markers. -- markers.
-- --
@@ -136,7 +136,6 @@ local parse_args = function()
end end
local marker_style = stdnse.get_script_args(SCRIPT_NAME .. ".marker_style") local marker_style = stdnse.get_script_args(SCRIPT_NAME .. ".marker_style")
stdnse.debug1('--> [%s]', marker_style)
if not marker_style then if not marker_style then
marker_style = "" marker_style = ""
end end