mirror of
https://github.com/nmap/nmap.git
synced 2026-08-27 03:48:14 +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 sys
|
||||||
import time
|
import time
|
||||||
import xml.sax
|
import xml.sax
|
||||||
|
import xml.sax.saxutils
|
||||||
import xml.dom.minidom
|
import xml.dom.minidom
|
||||||
|
|
||||||
verbose = False
|
verbose = False
|
||||||
|
|
@ -61,6 +62,22 @@ class Scan(object):
|
||||||
finally:
|
finally:
|
||||||
f.close()
|
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):
|
def nmaprun_to_dom_fragment(self, document):
|
||||||
frag = document.createDocumentFragment()
|
frag = document.createDocumentFragment()
|
||||||
elem = document.createElement(u"nmaprun")
|
elem = document.createElement(u"nmaprun")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue