Geoip map #606

Closed
wants to merge 18 commits into
from

Projects

None yet

2 participants

@dmiller-nmap

Let's get this into Nmap!

@dmiller-nmap

@mogigoma This is looking good! There were a couple issues with missing libraries (string, table), and one place where you used query instead of path in an error message return. Use the check script or git hooks to check this stuff.

Of a bit more concern, when I use the KML script with ip-geolocation-geoplugin and then import into mymaps.google.com, it won't show anything with a negative longitude. Is there a standard for this that Google is expecting but Geoplugin is providing differently? Should we be doing some sort of conversion?

For the KML script, if your output is just a message as a string, it's ok to just return that. No need to mess around with stdnse.output_table() or stdnse.format_output. In fact, it's usually incorrect to mix those two.

Try to reduce the number of calls to table.insert in ip-geolocation-map-kml. Create the table with a single string element containing the file header. Insert one element into the table per coordinate: the KML for that point. It can contain newlines, you can format it with string.format, or anything. That is cheaper and cleaner than building a table with 6 times as many elements as necessary.

Overall, this looks great, and I'd like to get it done this week.

@mogigoma
mogigoma commented Dec 8, 2016 edited

I had the Git hook in place but it was failing without me noticing due to reinstalling and not having lua5.2 and pep8 installed. Ran all files through nmap-check.sh, should be good now.

For the KML, swapped lat and lon and added protections in the library against nonsensical GPS coords. KML script now has fewer concats and inserts. Used [[ ... ]] notation and out-dented further than normal to get the KML output to look right, seemed better than lots of \n[sp][sp][sp][sp] to get the indentation correct.

@nmap-bot nmap-bot closed this in c12c2eb Dec 17, 2016
@suraj51k suraj51k added a commit to suraj51k/nmap that referenced this pull request Jan 31, 2017
@bonsaiviking @suraj51k bonsaiviking + suraj51k New scripts for geo mapping. Closes #606 eb3255d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment