Island: Subscribe save_stolen_credentials_to_repository()

This commit is contained in:
Mike Salvatore 2022-09-14 13:54:38 -04:00
parent 4db251dd7d
commit b3e9bbe05f
1 changed files with 11 additions and 2 deletions

View File

@ -1,7 +1,11 @@
from common import DIContainer
from common.event_queue import IAgentEventQueue
from monkey_island.cc.agent_event_subscribers import save_event_to_event_repository
from monkey_island.cc.repository import IEventRepository
from common.events import CredentialsStolenEvent
from monkey_island.cc.agent_event_subscribers import (
save_event_to_event_repository,
save_stolen_credentials_to_repository,
)
from monkey_island.cc.repository import ICredentialsRepository, IEventRepository
def setup_agent_event_handlers(container: DIContainer):
@ -14,3 +18,8 @@ def _subscribe_and_store_to_event_repository(container: DIContainer):
event_repository = container.resolve(IEventRepository)
save_event_subscriber = save_event_to_event_repository(event_repository)
agent_event_queue.subscribe_all_events(save_event_subscriber)
save_stolen_credentials_subscriber = save_stolen_credentials_to_repository(
container.resolve(ICredentialsRepository)
)
agent_event_queue.subscribe_type(CredentialsStolenEvent, save_stolen_credentials_subscriber)