Skip to content

Commit

Permalink
prevent graph orphans
Browse files Browse the repository at this point in the history
  • Loading branch information
TheTechromancer committed Jul 28, 2024
1 parent 2c04d80 commit ef368e2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions bbot/core/engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,7 @@ async def new_socket(self):
async def shutdown(self):
if not self._shutdown_status:
self._shutdown_status = True
self.log.hugewarning(f"{self.name}: shutting down...")
self.log.verbose(f"{self.name}: shutting down...")
# send shutdown signal
await self.send_shutdown_message()
# then terminate context
Expand Down Expand Up @@ -513,7 +513,7 @@ async def worker(self):

async def _shutdown(self):
if not self._shutdown_status:
self.log.critical(f"{self.name}: shutting down...")
self.log.verbose(f"{self.name}: shutting down...")
self._shutdown_status = True
await self.cancel_all_tasks()
try:
Expand Down
6 changes: 4 additions & 2 deletions bbot/scanner/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,15 @@ async def handle_event(self, event, **kwargs):
# if we discovered something interesting from an internal event,
# make sure we preserve its chain of parents
parent = event.parent
if parent.internal and ((not event.internal) or event._graph_important):
event_is_graph_worthy = (not event.internal) or event._graph_important
parent_is_graph_worthy = (not parent.internal) or parent._graph_important
if event_is_graph_worthy and not parent_is_graph_worthy:
parent_in_report_distance = parent.scope_distance <= self.scan.scope_report_distance
if parent_in_report_distance:
parent.internal = False
if not parent._graph_important:
parent._graph_important = True
log.debug(f"Re-queuing internal event {parent} with parent {event}")
log.debug(f"Re-queuing internal event {parent} with parent {event} to prevent graph orphan")
await self.emit_event(parent)

abort_result = False
Expand Down

0 comments on commit ef368e2

Please sign in to comment.