mirror of
https://github.com/nmap/nmap.git
synced 2025-12-28 02:19:04 +00:00
Add OS difference reporting to Ndiff. It looks like
Remove OS "Linux 2.6.18 - 2.6.25".
Remove OS "Linux 2.6.8 - 2.6.20".
Remove OS "OpenWrt (Linux 2.6.19 - 2.6.21)".
Add OS "Archos 605 WiFi video player".
Add OS "Linux 2.6.27 (Ubuntu)".
Add OS "Linux 2.6.22".
Add OS "Linux 2.6.27".
This commit is contained in:
@@ -109,6 +109,18 @@ The host had a hostname in the A scan that it didn't have in the B scan.
|
||||
-->
|
||||
<!ELEMENT host-hostname-remove (hostname)>
|
||||
|
||||
<!--
|
||||
The host gained an OS in the B scan that it didn't have in the A scan.
|
||||
-->
|
||||
<!ELEMENT host-os-add EMPTY>
|
||||
<!attlist host-os-add name #REQUIRED>
|
||||
|
||||
<!--
|
||||
The host had an OS in the A scan that it didn't have in the B scan.
|
||||
-->
|
||||
<!ELEMENT host-os-remove EMPTY>
|
||||
<!attlist host-os-remove name #REQUIRED>
|
||||
|
||||
<!--
|
||||
The services that were running on two ports were swapped between the A
|
||||
and B scans. The portid and protocol attributes give the A and B port
|
||||
|
||||
34
ndiff/ndiff
34
ndiff/ndiff
@@ -313,6 +313,34 @@ class HostHostnameRemoveHunk(DiffHunk):
|
||||
elem.appendChild(address_elem)
|
||||
return frag
|
||||
|
||||
class HostOsAddHunk(DiffHunk):
|
||||
def __init__(self, os):
|
||||
self.os = os
|
||||
|
||||
def to_string(self):
|
||||
return u"Add OS \"%s\"." % self.os
|
||||
|
||||
def to_dom_fragment(self, document):
|
||||
frag = document.createDocumentFragment()
|
||||
elem = document.createElement(u"host-os-add")
|
||||
elem.setAttribute(u"name", self.os)
|
||||
frag.appendChild(elem)
|
||||
return frag
|
||||
|
||||
class HostOsRemoveHunk(DiffHunk):
|
||||
def __init__(self, os):
|
||||
self.os = os
|
||||
|
||||
def to_string(self):
|
||||
return u"Remove OS \"%s\"." % self.os
|
||||
|
||||
def to_dom_fragment(self, document):
|
||||
frag = document.createDocumentFragment()
|
||||
elem = document.createElement(u"host-os-remove")
|
||||
elem.setAttribute(u"name", self.os)
|
||||
frag.appendChild(elem)
|
||||
return frag
|
||||
|
||||
class PortIdChangeHunk(DiffHunk):
|
||||
def __init__(self, a_spec, b_spec):
|
||||
self.a_spec = a_spec
|
||||
@@ -531,6 +559,12 @@ def host_diff(a, b):
|
||||
all_specs.sort()
|
||||
for spec in all_specs:
|
||||
diff.extend(port_diff(a.ports[spec], b.ports[spec]))
|
||||
|
||||
for os in set(a.os) - set(b.os):
|
||||
diff.append(HostOsRemoveHunk(os))
|
||||
for os in set(b.os) - set(a.os):
|
||||
diff.append(HostOsAddHunk(os))
|
||||
|
||||
return diff
|
||||
|
||||
def scan_diff(a, b):
|
||||
|
||||
Reference in New Issue
Block a user