diff --git a/bbot/modules/internal/speculate.py b/bbot/modules/internal/speculate.py index c465a673a..1b98ce0cc 100644 --- a/bbot/modules/internal/speculate.py +++ b/bbot/modules/internal/speculate.py @@ -42,7 +42,7 @@ async def setup(self): port_string = self.config.get("ports", "80,443") try: - self.ports = self.helpers.parse_port_string(port_string) + self.ports = self.helpers.parse_port_string(str(port_string)) except ValueError as e: self.warning(f"Error parsing ports: {e}") return False diff --git a/bbot/scanner/manager.py b/bbot/scanner/manager.py index 21b589c28..a0ac44488 100644 --- a/bbot/scanner/manager.py +++ b/bbot/scanner/manager.py @@ -235,14 +235,15 @@ async def _emit_event(self, event, **kwargs): # Scope shepherding # here is where we make sure in-scope events are set to their proper scope distance - if event.host and event_whitelisted: - log.debug(f"Making {event} in-scope") - event.scope_distance = 0 - elif (not event.always_emit) and event.scope_distance > self.scan.scope_report_distance: - log.debug( - f"Making {event} internal because its scope_distance ({event.scope_distance}) > scope_report_distance ({self.scan.scope_report_distance})" - ) - event.make_internal() + if event.host: + if event_whitelisted: + log.debug(f"Making {event} in-scope") + event.scope_distance = 0 + elif (not event.always_emit) and event.scope_distance > self.scan.scope_report_distance: + log.debug( + f"Making {event} internal because its scope_distance ({event.scope_distance}) > scope_report_distance ({self.scan.scope_report_distance})" + ) + event.make_internal() # check for wildcards if event.scope_distance <= self.scan.scope_search_distance: diff --git a/bbot/test/test_step_1/test_events.py b/bbot/test/test_step_1/test_events.py index a16b5a923..cf1a36967 100644 --- a/bbot/test/test_step_1/test_events.py +++ b/bbot/test/test_step_1/test_events.py @@ -158,19 +158,6 @@ async def test_events(events, scan, helpers, bbot_config): internal_event1 = scan.make_event("1.2.3.4", source=root_event, internal=True) assert internal_event1._internal == True assert "internal" in internal_event1.tags - internal_event1.scope_distance = 0 - assert internal_event1._internal == False - assert "internal" not in internal_event1.tags - internal_event2 = scan.make_event("2.3.4.5", source=internal_event1, internal=True) - internal_event3 = scan.make_event("3.4.5.6", source=internal_event2, internal=True) - internal_event4 = scan.make_event("4.5.6.7", source=internal_event3) - source_trail = internal_event4.scope_distance = 0 - assert internal_event4._internal == False - assert internal_event3._internal == False - assert internal_event2._internal == False - assert len(source_trail) == 2 - assert internal_event2 in source_trail - assert internal_event3 in source_trail # event sorting parent1 = scan.make_event("127.0.0.1", source=scan.root_event)