Nmap Development mailing list archives

Re: [NSE] hostmap-ip2hosts


From: David Fifield <david () bamsoftware com>
Date: Sat, 27 Apr 2013 09:40:33 -0700

On Sat, Apr 06, 2013 at 05:10:55PM -0600, Paulino Calderon wrote:
I've been using a version of this script for host mapping for a
while and I finally update it today to add XML output support. I've
been running the service ip2hosts.com for about two years and it
uses BING's host db.

I have some suggestions for the XML output formatting. Here is what it
looks like now:

<script id="hostmap-ip2hosts">
  <elem key="ip">173.255.243.189</elem>
  <elem 
key="hosts">&#xa;http://insecure.org&#xa;http://nmap.org&#xa;http://sectools.org&#xa;https://svn.nmap.org&#xa;http://cgi.insecure.org</elem>
  <elem key="output">Saved to hostmap-nmap.org&#xa;</elem>
</script>

It should rather look like this:

<script id="hostmap-ip2hosts">
  <table key="domains">
    <elem>insecure.org</elem>
    <elem>nmap.org</elem>
    <elem>sectools.org</elem>
    <elem>svn.nmap.org</elem>
    <elem>cgi.insecure.org</elem>
  </table>
  <elem key="filename">hostmap-nmap.org</elem>
</script>

That is, remove the "ip" output because that is already part of the
output. Remove the http:// prefixes so the output is domain names and
not URLs, and put the names in an actual array, not a text string. Just
use
        output.domains = hostnames
not
        output.domains = "\n" .. stdnse.strjoin("\n", hostnames)
Structured output should be in the form that is convenient for a
programmer--you shouldn't have to re-split the hostnames array. There
shouldn't be human-readable labels like "Saved to" nor extra newlines in
structured output.

You should also add a sample of the structured output in an @xmloutput
tag.

Do you think you could make these structured output changes in the other
hostmap scripts as well?

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


Current thread: