Nmap Development mailing list archives

Re: NSE structured output--normal output formatting


From: Aleksandar Nikolic <nikolic.alek () gmail com>
Date: Fri, 27 Jul 2012 16:46:09 +0200

Hi all,

on our last nse meeting , David asked us to see if we could adapt some
of our scripts to work well with Daniel's xml-output branch
(https://svn.nmap.org/nmap-exp/dmiller/xml-output/).
The idea was to see how much work would it need and to make some
examples to see how things should
work.

I've picked up my dns-nsec3-enum script to make it suitable for xml
output and here are my comments.

As the script already builds a table for it's output, not much needed to
be changed, and all the changes
seem natural. Actual changes required were minimal. "Biggest" problem
was element ordering which
wasn't that much of a problem, as I can set ordering by something like :
           
stdnse.set_tostring(result,stdnse.format_generator({key_order =
{"domain_info","hashes","total_hashes"}}))

Sample xml output is:
<table>
    <table key="hashes">
        <elem>nexthash jn29pj2cc5g8raagtt12pkr0lghiorgi
jni9pg73ho9djg5uencea5fv9lce3vbh</elem>
        <elem>nexthash 8ne56rkodj8ugu2dbrbi50g6j408l0fm
8qp1qh2hnh2upad8r3vkhetln7v4vbhb</elem>
        ... (more hashes here, a lot more)
        <elem>nexthash um77ja0arlmihc2n69mmhbddq3b9jc1j
un2m24fdtsh5ma1a6k1npjj8bnbe09oq</elem>
    </table>
    <table key="domain_info">
        <elem key="Iterations">5</elem>
        <elem key="Salt">AABBCCDDEEFFAABB</elem>
        <elem key="Domain">example.com</elem>
    </table>
    <elem key="total_hashes">1080</elem>
</table>

And sample normal ouput :
53/udp open|filtered domain  no-response
| dns-nsec3-enum:
|
| domain_info:
| Domain: example.com
| Salt: AABBCCDDEEFFAABB
| Iterations: 5
| hashes:
|   nexthash jn29pj2cc5g8raagtt12pkr0lghiorgi
jni9pg73ho9djg5uencea5fv9lce3vbh
|   nexthash ekev2le03m8altheblpgbeh4i183bso1
ekt9utd533ad3kpf19qjkn6n4j13akqv
|   nexthash duoiqfbg5uahurj49ltg5k49v6b8g5gd
e12ig006mdgerilcp86uhfqlbc8ja24i
    ... (more hashes here, a lot more)
|   nexthash um77ja0arlmihc2n69mmhbddq3b9jc1j
un2m24fdtsh5ma1a6k1npjj8bnbe09oq
|_total_hashes: 1080

Granted, there should be a couple of cosmetic changes, but I think this
illustrates usage pretty well.

I have to say that the changes I had to make to the script look natural
, and weren't a problem at all.

The patched script is in xml-output branch.


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


Current thread: