Agent: Move subscribtion to a separate method for readability

This commit is contained in:
Ilija Lazoroski 2022-08-16 10:31:55 +02:00
parent 2a94a67767
commit 706a626d24
1 changed files with 10 additions and 4 deletions

View File

@ -206,10 +206,7 @@ class InfectionMonkey:
credentials_store = AggregatingPropagationCredentialsRepository(control_channel)
event_queue = PyPubSubEventQueue(Publisher())
event_queue.subscribe_type(
CredentialsStolenEvent,
add_credentials_from_event_to_propagation_credentials_repository(credentials_store),
)
InfectionMonkey._subscribe_events(event_queue, credentials_store)
puppet = self._build_puppet(credentials_store, event_queue)
@ -232,6 +229,15 @@ class InfectionMonkey:
credentials_store,
)
@staticmethod
def _subscribe_events(
event_queue: IEventQueue, credentials_store: IPropagationCredentialsRepository
):
event_queue.subscribe_type(
CredentialsStolenEvent,
add_credentials_from_event_to_propagation_credentials_repository(credentials_store),
)
@staticmethod
def _get_local_network_interfaces():
local_network_interfaces = get_local_network_interfaces()