diff --git a/nselib/geoip.lua b/nselib/geoip.lua index 15f50519d..414e6d7c4 100644 --- a/nselib/geoip.lua +++ b/nselib/geoip.lua @@ -15,28 +15,26 @@ _ENV = stdnse.module("geoip", stdnse.seeall) -- @param lat The latitude in degrees -- @param lon The longitude in degrees 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) - 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) return end 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) return end - nmap.registry.geoip[ip]["latitude"] = lat - nmap.registry.geoip[ip]["longitude"] = lon + if not nmap.registry.geoip then + nmap.registry.geoip = {} + end + + nmap.registry.geoip[ip] = { + latitude = lat, + longitude = lon + } end --- Check if any coordinates have been stored in the registry diff --git a/scripts/ip-geolocation-map-bing.nse b/scripts/ip-geolocation-map-bing.nse index cdb0498d5..134b0add1 100644 --- a/scripts/ip-geolocation-map-bing.nse +++ b/scripts/ip-geolocation-map-bing.nse @@ -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 -- 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 -- markers. -- diff --git a/scripts/ip-geolocation-map-google.nse b/scripts/ip-geolocation-map-google.nse index 9ad4008cb..7feca139d 100644 --- a/scripts/ip-geolocation-map-google.nse +++ b/scripts/ip-geolocation-map-google.nse @@ -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 -- 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 -- markers. -- @@ -136,7 +136,6 @@ local parse_args = function() end local marker_style = stdnse.get_script_args(SCRIPT_NAME .. ".marker_style") - stdnse.debug1('--> [%s]', marker_style) if not marker_style then marker_style = "" end