Home page logo
/

nmap-dev logo Nmap Development mailing list archives

[NDiff] ndiff.dtd invalid
From: Daniel Miller <bonsaiviking () gmail com>
Date: Wed, 02 Feb 2011 15:55:34 -0600

Hey list,

Two issues here:
1. The ndiff/docs/ndiff.dtd DTD is invalid with regard to the XML generated by Ndiff as of r22140. Patch:

--- ndiff/docs/ndiff.dtd    2010-05-13 14:45:58.209638395 -0500
+++ ../ndiff.dtd    2011-02-02 15:20:33.487421222 -0600
@@ -124,6 +124,6 @@

<!ELEMENT hostscript (script | a | b)*>

-<!ENTITY % diff-elem "(host | hostname | extraports* | port | state | service | script | os | osmatch* | hostscript)"> +<!ENTITY % diff-elem "(address | status | host | hostname | extraports* | port | state | service | script | os | osmatch* | hostscript)">
<!ELEMENT a %diff-elem;>
<!ELEMENT b %diff-elem;>

2. The XML generated by Ndiff is invalid according to the DTD. All <script> elements are expected to be children of <a>, <b>, <hostscript>, or <port> elements, but ndiff is producing sequences like this:
<a>
<script id="ipidseq" output="All zeros"/>
<script id="sniffer-detect" output="Likely in promiscuous mode (tests: &quot;11111111&quot;)"/>
<hostscript/>
</a>

Found the error, patch:

--- ndiff/ndiff    2011-01-31 09:50:26.939540874 -0600
+++ ../ndiff.py    2011-02-02 15:52:02.281523883 -0600
@@ -720,13 +720,13 @@
             elif len(host_b.script_results) == 0:
                 a_elem = document.createElement(u"a")
                 for sr in host_a.script_results:
-                    a_elem.appendChild(sr.to_dom_fragment(document))
+ hostscript_elem.appendChild(sr.to_dom_fragment(document))
                 a_elem.appendChild(hostscript_elem)
                 host_elem.appendChild(a_elem)
             elif len(host_a.script_results) == 0:
                 b_elem = document.createElement(u"b")
                 for sr in host_b.script_results:
-                    b_elem.appendChild(sr.to_dom_fragment(document))
+ hostscript_elem.appendChild(sr.to_dom_fragment(document))
                 b_elem.appendChild(hostscript_elem)
                 host_elem.appendChild(b_elem)
             else:

Thanks for a great tool!
Dan




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


  By Date           By Thread  

Current thread:
[ Nmap | Sec Tools | Mailing Lists | Site News | About/Contact | Advertising | Privacy ]