Agent: Add a custom PBA run check

We only want to run the custom PBA if commands are specified
This commit is contained in:
vakarisz 2022-03-30 14:26:45 +03:00
parent 079d768f73
commit 67543ef91a
1 changed files with 3 additions and 1 deletions

View File

@ -15,6 +15,7 @@ from infection_monkey.telemetry.post_breach_telem import PostBreachTelem
from infection_monkey.utils.threading import create_daemon_thread, interruptible_iter
from infection_monkey.utils.timer import Timer
from ..post_breach.custom_pba.custom_pba import CustomPBA
from . import Exploiter, IPScanner, Propagator
CHECK_ISLAND_FOR_STOP_COMMAND_INTERVAL_SEC = 5
@ -213,7 +214,8 @@ class AutomatedMaster(IMaster):
):
self._run_plugins(plugins, "post-breach action", callback)
self._run_plugins([("CustomPBA", custom_pba_options)], "post-breach action", callback)
if CustomPBA.should_run(custom_pba_options):
self._run_plugins([("CustomPBA", custom_pba_options)], "post-breach action", callback)
def _run_plugins(
self, plugins: Iterable[Any], plugin_type: str, callback: Callable[[Any], None]