forked from p15670423/monkey
Agent: Initialize CustomPBA with a ControlClient object
This is done to refactor ControlClient from a global
This commit is contained in:
parent
049eb1b174
commit
a099f21f61
|
@ -25,11 +25,12 @@ class CustomPBA(PBA):
|
||||||
Defines user's configured post breach action.
|
Defines user's configured post breach action.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, telemetry_messenger: ITelemetryMessenger):
|
def __init__(self, telemetry_messenger: ITelemetryMessenger, cc_client: ControlClient):
|
||||||
super(CustomPBA, self).__init__(
|
super(CustomPBA, self).__init__(
|
||||||
telemetry_messenger, POST_BREACH_FILE_EXECUTION, timeout=None
|
telemetry_messenger, POST_BREACH_FILE_EXECUTION, timeout=None
|
||||||
)
|
)
|
||||||
self.filename = ""
|
self.filename = ""
|
||||||
|
self.cc_client = cc_client
|
||||||
|
|
||||||
def run(self, options: Dict) -> Iterable[PostBreachData]:
|
def run(self, options: Dict) -> Iterable[PostBreachData]:
|
||||||
self._set_options(options)
|
self._set_options(options)
|
||||||
|
@ -75,7 +76,7 @@ class CustomPBA(PBA):
|
||||||
:return: True if successful, false otherwise
|
:return: True if successful, false otherwise
|
||||||
"""
|
"""
|
||||||
|
|
||||||
pba_file_contents = ControlClient.get_pba_file(filename)
|
pba_file_contents = self.cc_client.get_pba_file(filename)
|
||||||
|
|
||||||
status = None
|
status = None
|
||||||
if not pba_file_contents or not pba_file_contents.content:
|
if not pba_file_contents or not pba_file_contents.content:
|
||||||
|
|
Loading…
Reference in New Issue