Island: Subscribe ICredentialsRepository to CLEAR_SIMULATION_DATA

This commit is contained in:
Mike Salvatore 2022-09-12 13:51:45 -04:00 committed by Ilija Lazoroski
parent 745027bf93
commit 9479b56722
1 changed files with 10 additions and 0 deletions

View File

@ -1,12 +1,14 @@
from common import DIContainer
from monkey_island.cc.event_queue import IIslandEventQueue, IslandEventTopic
from monkey_island.cc.island_event_handlers import reset_agent_configuration
from monkey_island.cc.repository import ICredentialsRepository
def setup_island_event_handlers(container: DIContainer):
event_queue = container.resolve(IIslandEventQueue)
_handle_reset_agent_configuration_events(event_queue, container)
_handle_clear_simulation_data_events(event_queue, container)
def _handle_reset_agent_configuration_events(
@ -15,3 +17,11 @@ def _handle_reset_agent_configuration_events(
event_queue.subscribe(
IslandEventTopic.RESET_AGENT_CONFIGURATION, container.resolve(reset_agent_configuration)
)
def _handle_clear_simulation_data_events(event_queue: IIslandEventQueue, container: DIContainer):
credentials_repository = container.resolve(ICredentialsRepository)
event_queue.subscribe(
IslandEventTopic.CLEAR_SIMULATION_DATA, credentials_repository.remove_stolen_credentials
)