Nmap Development mailing list archives

Re: xml.sax._exceptions.SAXParseException: scan-2016-02-01.xml:2201:0: no element found


From: Daniel Miller <bonsaiviking () gmail com>
Date: Fri, 12 Feb 2016 08:46:46 -0600

Micah,

It looks like your scan has not finished running. It is in the middle of
NSE scanning (as a result of the -sV in your command line, it is running
all NSE scripts in the "version" category). You should make sure Nmap is
done scanning before you try to compare results with Ndiff.

On the other hand, I see a "Segmentation fault" error just before the
Python traceback. It *might* be possible that Nmap is crashing, leaving an
unfinished XML file. Is there any way you can manually run your scan with
debugging output to determine what if anything might be causing that crash?

Dan

On Tue, Feb 2, 2016 at 9:14 AM, micah anderson <micah () riseup net> wrote:


Hi,

I'm running nmap (7.01-2 from debian) scans out of cron once a day and
trying to ndiff the results, but each time I'm getting the same python
traceback and error.

I'm basically doing this:

/usr/bin/nmap -v --open -sV --datadir /home/nmap/scans  $TARGETS -oA
scan-$date > /dev/null

and then comparing the scans like this:

/usr/bin/ndiff scan-prev.xml scan-$date.xml > diff-$date

the error I get is this:

Segmentation fault
Traceback (most recent call last):
  File "/usr/bin/ndiff", line 85, in <module>
    sys.exit(ndiff.main())
  File "/usr/lib/python2.7/dist-packages/ndiff.py", line 1503, in main
    scan_b.load_from_file(filename_b)
  File "/usr/lib/python2.7/dist-packages/ndiff.py", line 74, in
load_from_file
    self.load(f)
  File "/usr/lib/python2.7/dist-packages/ndiff.py", line 68, in load
    parser.parse(f)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 110, in parse
    xmlreader.IncrementalParser.parse(self, source)
  File "/usr/lib/python2.7/xml/sax/xmlreader.py", line 125, in parse
    self.close()
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 225, in close
    self.feed("", isFinal = 1)
  File "/usr/lib/python2.7/xml/sax/expatreader.py", line 217, in feed
    self._err_handler.fatalError(exc)
  File "/usr/lib/python2.7/xml/sax/handler.py", line 38, in fatalError
    raise exception
xml.sax._exceptions.SAXParseException: scan-2016-02-01.xml:2201:0: no
element found

That file (scan-2016-02-01.xml) looks like normal xml, if I run an xml
validator on it, I'm told: Error: Document ends too soon  in unnamed
entity at line 2200 char 43 of file, if I go to that line in the file, I
find this:

...
<taskend task="Connect Scan" time="1454367205" extrainfo="39000 total
ports"/>
<taskbegin task="Service scan" time="1454367205"/>
<taskprogress task="Service scan" time="1454367237" percent="28.40"
remaining="81" etc="1454367318"/>
<taskprogress task="Service scan" time="1454367273" percent="52.67"
remaining="62" etc="1454367334"/>
<taskprogress task="Service scan" time="1454367303" percent="71.60"
remaining="39" etc="1454367342"/>
<taskend task="Service scan" time="1454367460" extrainfo="243 services on
39 hosts"/>
<taskbegin task="NSE" time="1454367460"/>

line 2200 is the last line above, the last character on the line ('>')
is character number 41

thanks for any suggestions or help!
micah
_______________________________________________
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: