I discovered that parser.rb raises an unavoidable exception when it is being fed with a source nmap XML which has incomplete and/or missing 'runstats/finished' tag. I made a simple patch which adds 3 conditions against these optional/missing tags. I'll attach the patched parser.rb file alongside this post. I hope you can include this fix in your next release. Cheers.
Details of the fix:
def parse(root)
@scan_args = root.attributes['args']
@nmap_version = root.attributes['version']
@xml_version = root.attributes['xmloutputversion'].to_f
@start_str = root.attributes['startstr']
@start_time = root.attributes['start'].to_i
@stop_str = root.elements['runstats/finished'].attributes['timestr'] if root.elements['runstats/finished'] <-- ADDED
@stop_time = root.elements['runstats/finished'].attributes['time'].to_i if root.elements['runstats/finished'] <-- ADDED
@scan_time = root.elements['runstats/finished'].attributes['elapsed'].to_f if root.elements['runstats/finished'] <-- ADDED
@verbose = root.elements['verbose'].attributes['level'].to_i
@debug = root.elements['debugging'].attributes['level'].to_i
@scaninfo = root.elements.collect('scaninfo') do |info|
ScanInfo.new(info)
end
end
Fix to missing 'runstats/finished' tag parsing