mirror of
https://github.com/nmap/nmap.git
synced 2026-06-11 02:26:11 +00:00
Add event-based write_nmaprun_open and write_nmaprun_close.
These allow beginning and ending an nmaprun without having to keep its children in memory.
This commit is contained in:
parent
4ec4641ce8
commit
e2d5d41b28
1 changed files with 17 additions and 0 deletions
17
ndiff/ndiff
17
ndiff/ndiff
|
|
@ -19,6 +19,7 @@ import getopt
|
|||
import sys
|
||||
import time
|
||||
import xml.sax
|
||||
import xml.sax.saxutils
|
||||
import xml.dom.minidom
|
||||
|
||||
verbose = False
|
||||
|
|
@ -61,6 +62,22 @@ class Scan(object):
|
|||
finally:
|
||||
f.close()
|
||||
|
||||
def write_nmaprun_open(self, writer):
|
||||
attrs = {}
|
||||
if self.scanner is not None:
|
||||
attrs[u"scanner"] = self.scanner
|
||||
if self.args is not None:
|
||||
attrs[u"args"] = self.args
|
||||
if self.start_date is not None:
|
||||
attrs[u"start"] = "%d" % time.mktime(self.start_date.timetuple())
|
||||
attrs[u"startstr"] = self.start_date.strftime("%a %b %d %H:%M:%S %Y")
|
||||
if self.version is not None:
|
||||
attrs[u"version"] = self.version
|
||||
writer.startElement(u"nmaprun", attrs)
|
||||
|
||||
def write_nmaprun_close(self, writer):
|
||||
writer.endElement(u"nmaprun")
|
||||
|
||||
def nmaprun_to_dom_fragment(self, document):
|
||||
frag = document.createDocumentFragment()
|
||||
elem = document.createElement(u"nmaprun")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue