Nmap Development mailing list archives

Re: [nmap-svn] r27941 - nmap/scripts


From: David Fifield <david () bamsoftware com>
Date: Sat, 28 Jan 2012 16:17:29 -0800

On Sat, Jan 28, 2012 at 02:03:11PM -0800, commit-mailer () insecure org wrote:
Modified: nmap/scripts/ip-geolocation-geoplugin.nse
==============================================================================
--- nmap/scripts/ip-geolocation-geoplugin.nse (original)
+++ nmap/scripts/ip-geolocation-geoplugin.nse Sat Jan 28 14:03:11 2012
@@ -41,7 +41,10 @@
      
      local output = {}
      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)

Would this be better
        local regionName = (loc.geoplugin_regionName == json.NULL) and "Unknown" or loc.geoplugin_regionName

David Fifield
_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://seclists.org/nmap-dev/


Current thread: