1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-09 14:11:29 +00:00

Don't ignore host state changes when the change is to the state "unknown". This

happens when a host was scanned in the A scan but wasn't scanned in the B scan.
I previously had it ignore such changes using the logic that the diff should be
like scan aggregation: no new information means no state change. But I think
it's more useful to see those changes in which hosts were scanned.

This is analogous to r10263, which did the same thing for port state changes.
This commit is contained in:
david
2009-01-20 21:02:15 +00:00
parent 47198b7159
commit c4b27a31b4
3 changed files with 18 additions and 6 deletions

View File

@@ -487,7 +487,7 @@ class scan_diff_test(unittest.TestCase):
for host, h_diff in diff:
for hunk in h_diff:
if hunk.type == HOST_STATE_CHANGE:
self.assertTrue(hunk.a_state == Port.UNKNOWN)
self.assertTrue(hunk.a_state == Host.UNKNOWN)
self.assertTrue(hunk.b_state == u"up")
break
else:
@@ -499,7 +499,14 @@ class scan_diff_test(unittest.TestCase):
b = Scan()
b.load_from_file("test-scans/empty.xml")
diff = scan_diff(a, b)
self.assertTrue(len(diff) == 0)
for host, h_diff in diff:
for hunk in h_diff:
if hunk.type == HOST_STATE_CHANGE:
self.assertTrue(hunk.a_state == u"up")
self.assertTrue(hunk.b_state == Port.UNKNOWN)
break
else:
fail("No host state change found.")
def test_diff_is_effective(self):
"""Test that a scan diff is effective.