MCPcopy Index your code
hub / github.com/blacklanternsecurity/bbot / update_event

Method update_event

bbot/modules/base.py:540–571  ·  view source on GitHub ↗

Update an existing event for the scan. This is the counterpart to :meth:`make_event` for modifying an existing :class:`bbot.core.event.base.BaseEvent` instance. Raises a validation error if the update could not be applied, unless ``raise_error`` is set to False.

(self, event, **kwargs)

Source from the content-addressed store, hash-verified

538 return event
539
540 def update_event(self, event, **kwargs):
541 """Update an existing event for the scan.
542
543 This is the counterpart to :meth:`make_event` for modifying an existing
544 :class:`bbot.core.event.base.BaseEvent` instance.
545
546 Raises a validation error if the update could not be applied, unless
547 ``raise_error`` is set to False.
548
549 Args:
550 event: The event object to update.
551 **kwargs: Keyword arguments to be passed to the scan's update_event method.
552 raise_error (bool, optional): Whether to raise a validation error if the event could not be updated. Defaults to False.
553
554 Returns:
555 Event or None: The updated event, or None if a validation error occurred and raise_error was False.
556
557 Raises:
558 ValidationError: If the event could not be validated and raise_error is True.
559 """
560 raise_error = kwargs.pop("raise_error", False)
561 module = kwargs.pop("module", None)
562 if module is None and getattr(event, "module", None) is None:
563 kwargs["module"] = self
564 try:
565 updated = self.scan.update_event(event, **kwargs)
566 except ValidationError as e:
567 if raise_error:
568 raise
569 self.warning(f"{e}")
570 return
571 return updated
572
573 async def emit_event(self, *args, **kwargs):
574 """Emit an event to the event queue and distribute it to interested modules.

Callers 1

emit_eventMethod · 0.95

Calls 2

warningMethod · 0.95
popMethod · 0.80

Tested by

no test coverage detected