Nmap Development mailing list archives

Re: DTD and XML output do not match


From: Daniel Miller <bonsaiviking () gmail com>
Date: Fri, 21 Aug 2015 11:35:57 -0500

Jonathan,

Thanks for the catch! This could also happen if a script returns a number.
Applied your fix in r35197

Dan

On Mon, Aug 17, 2015 at 12:50 PM, Jonathan Daugherty <jtd () galois com> wrote:

Hi,

I've found that the XML output generated by nmap does not validate
against its provided DTD. Assuming the DTD is the problem, the required
DTD change is small and is shown below. I have verified that this
applies to both the version detailed below as well as the latest
release, nmap-6.49BETA4. Here are the details:

Example command: sudo nmap -A -sS -oX output2.xml 192.168.40.0/24

Version details:

Nmap version 6.47 ( http://nmap.org )
Platform: x86_64-apple-darwin14.3.0
Compiled with: liblua-5.2.3 openssl-1.0.2a nmap-libpcre-7.6 libpcap-1.5.3
nmap-libdnet-1.12 ipv6
Compiled without: Available nsock engines: kqueue poll select

Validation error:

$ xmllint ~/nmap_output.xml --dtdvalid nmap.dtd
output.xml:882: element script: validity error : Element script content
does not follow the DTD, expecting (table | elem)*, got (CDATA)

Relevant XML:

<script id="smbv2-enabled" output="Server supports SMBv2
protocol">true</script>

Relevant DTD:

<!ELEMENT script        (table|elem)* >

Fixed DTD:

<!ELEMENT script        (#PCDATA|table|elem)* >

--
  Jonathan Daugherty
  Software Engineer
  Galois, Inc.
_______________________________________________
Sent through the dev mailing list
https://nmap.org/mailman/listinfo/dev
Archived at http://seclists.org/nmap-dev/

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

Current thread: