Improve evidence classification and compact CLI reporting
This commit is contained in:
1 parent
9dc7289652
commit
dda4f8563f
28 files changed
+945
-87
No files matched your search
+14
-1
@@ -8,6 +8,19 @@ class MinimalReportTests(unittest.TestCase):
|
||||
def report(self, host, findings=None, principal=None):
|
||||
return Report("now", "test", [], None, principal, [host], findings or [])
|
||||
|
||||
def test_missing_requested_collector_is_not_complete_coverage(self):
|
||||
host = HostEvidence("192.0.2.1", checks={"ms17-010": "not-vulnerable"}, collection={"rpcdump": "missing"})
|
||||
self.assertTrue(coverage(host)[2])
|
||||
self.assertNotIn("NOT VULNERABLE", minimal(self.report(host)))
|
||||
|
||||
def test_conflict_does_not_print_positive_or_clean_verdict(self):
|
||||
host = HostEvidence("192.0.2.1", checks={"ms17-010": "vulnerable"})
|
||||
host.merge(HostEvidence(host.address, checks={"ms17-010": "not-vulnerable"}))
|
||||
text = minimal(self.report(host))
|
||||
self.assertIn("CONFLICT: [MS17-010]", text)
|
||||
self.assertNotIn(" VULN:", text)
|
||||
self.assertNotIn("NOT VULNERABLE", text)
|
||||
|
||||
def test_positive_vulnerability_line(self):
|
||||
host = HostEvidence("10.10.10.25", checks={"zerologon": "vulnerable"})
|
||||
line = minimal(self.report(host, principal="LAB\\auditor"))
|
||||
@@ -36,7 +49,7 @@ class MinimalReportTests(unittest.TestCase):
|
||||
def test_suspected_finishes_a_check_while_pending_remains_in_progress(self):
|
||||
host = HostEvidence("10.10.10.25", checks={"smbghost": "suspected", "ms17-010": "pending"})
|
||||
line = minimal(self.report(host))
|
||||
self.assertIn("SUSPECTED: [CVE-2020-0796/SMBGHOST]", line)
|
||||
self.assertIn("SUSPECTED: [SMB3-COMPRESSION]", line)
|
||||
self.assertIn("CHECKS: 1/2 (IN PROGRESS)", line)
|
||||
self.assertNotIn("NO VULNERABILITIES CONFIRMED", line)
|
||||
self.assertNotIn(" VULN:", line)
|
||||
|
||||
Reference in new issue
Block a user