Skip to content

Commit

Permalink
fix portscan tests
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Nov 19, 2024
1 parent 5041c16 commit 87b9f75
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions bbot/test/test_step_2/module_tests/test_module_portscan.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,10 +109,12 @@ def check(self, module_test, events):
if e.type == "DNS_NAME" and e.data == "dummy.asdf.evilcorp.net" and str(e.module) == "dummy_module"
]
)
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.8.8"]) <= 3
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.4"]) <= 3
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.5"]) <= 3
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.6"]) <= 3
# the reason these numbers aren't exactly predictable is because we can't predict which one arrives first
# to the portscan module. Sometimes, one that would normally be deduped is force-emitted because it led to a new open port.
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.8.8"]) <= 4
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.4"]) <= 4
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.5"]) <= 4
assert 2 <= len([e for e in events if e.type == "IP_ADDRESS" and e.data == "8.8.4.6"]) <= 4
assert 1 == len([e for e in events if e.type == "OPEN_TCP_PORT" and e.data == "8.8.8.8:443"])
assert 1 == len([e for e in events if e.type == "OPEN_TCP_PORT" and e.data == "8.8.4.5:80"])
assert 1 == len([e for e in events if e.type == "OPEN_TCP_PORT" and e.data == "8.8.4.6:631"])
Expand Down

0 comments on commit 87b9f75

Please sign in to comment.