diff --git a/monkey/infection_monkey/monkey.py b/monkey/infection_monkey/monkey.py index 8987a0ece..3baf112c3 100644 --- a/monkey/infection_monkey/monkey.py +++ b/monkey/infection_monkey/monkey.py @@ -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()