Skip to content

Commit

Permalink
revise speculate logic
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Dec 16, 2023
1 parent 5ae431c commit 4ba0180
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions bbot/modules/internal/speculate.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,14 @@ async def handle_event(self, event):

# generate open ports

# we speculate on distance-1 stuff too, because distance-1 open ports are needed by certain modules like sslcert
event_in_scope_distance = event.scope_distance <= (self.scan.scope_search_distance + 1)
speculate_open_ports = self.emit_open_ports and event_in_scope_distance

# from URLs
if event.type == "URL" or (event.type == "URL_UNVERIFIED" and self.open_port_consumers):
if event.host and event.port not in self.ports:
# only speculate port from a URL if it wouldn't be speculated naturally from the host
if event.host and (event.port not in self.ports or not speculate_open_ports):
self.emit_event(
self.helpers.make_netloc(event.host, event.port),
"OPEN_TCP_PORT",
Expand All @@ -99,7 +104,7 @@ async def handle_event(self, event):
self.emit_event(url_event)

# from hosts
if self.emit_open_ports and event.scope_distance <= self.scan.scope_search_distance:
if speculate_open_ports:
# don't act on unresolved DNS_NAMEs
usable_dns = False
if event.type == "DNS_NAME":
Expand Down

0 comments on commit 4ba0180

Please sign in to comment.