MCPcopy Create free account
hub / github.com/blacklanternsecurity/bbot / async_start

Method async_start

bbot/scanner/scanner.py:343–449  ·  view source on GitHub ↗

(self)

Source from the content-addressed store, hash-verified

341 pass
342
343 async def async_start(self):
344 """ """
345 self.start_time = datetime.now()
346 self.root_event.data["started_at"] = self.start_time.isoformat()
347 try:
348 await self._prep()
349
350 self._start_log_handlers()
351 self.trace(f"Ran BBOT {__version__} at {self.start_time}, command: {' '.join(sys.argv)}")
352 self.trace(f"Target: {self.preset.target.json}")
353 self.trace(f"Preset: {self.preset.to_dict(redact_secrets=True)}")
354
355 if not self.target:
356 self.warning("No scan targets specified")
357
358 # start status ticker
359 self.ticker_task = asyncio.create_task(
360 self._status_ticker(self.status_frequency), name=f"{self.name}._status_ticker()"
361 )
362
363 self.status = "STARTING"
364
365 if not self.modules:
366 self.error("No modules loaded")
367 self.status = "FAILED"
368 return
369 else:
370 self.hugesuccess(f"Starting scan {self.name}")
371
372 await self.dispatcher.on_start(self)
373
374 self.status = "RUNNING"
375 self._start_modules()
376 self.verbose(f"{len(self.modules):,} modules started")
377
378 # distribute seed events
379 self.init_events_task = asyncio.create_task(
380 self.ingress_module.init_events(self.target.seeds.event_seeds),
381 name=f"{self.name}.ingress_module.init_events()",
382 )
383
384 # main scan loop
385 while 1:
386 # abort if we're aborting
387 if self.aborting:
388 self._drain_queues()
389 break
390
391 # yield events as they come (async for event in scan.async_start())
392 if "python" in self.modules:
393 events, finish = await self.modules["python"]._events_waiting(batch_size=-1)
394 for e in events:
395 yield e
396 if events:
397 continue
398
399 # break if initialization finished and the scan is no longer active
400 if self._finished_init and self.modules_finished:

Callers 15

startFunction · 0.95
test_mobile_appFunction · 0.95
test_filesystemFunction · 0.95
test_rm_temp_dir_at_exitFunction · 0.95
test_python_apiFunction · 0.95
test_wildcardsFunction · 0.95
startMethod · 0.95
scanMethod · 0.80
test_scanFunction · 0.80

Calls 15

_prepMethod · 0.95
_start_log_handlersMethod · 0.95
traceMethod · 0.95
warningMethod · 0.95
_status_tickerMethod · 0.95
errorMethod · 0.95
hugesuccessMethod · 0.95
_start_modulesMethod · 0.95
verboseMethod · 0.95
_drain_queuesMethod · 0.95
finishMethod · 0.95
_mark_finishedMethod · 0.95

Tested by 15

startFunction · 0.76
test_mobile_appFunction · 0.76
test_filesystemFunction · 0.76
test_rm_temp_dir_at_exitFunction · 0.76
test_python_apiFunction · 0.76
test_wildcardsFunction · 0.76
test_scanFunction · 0.64
test_exclude_cdnFunction · 0.64
do_scanFunction · 0.64