diff --git a/monkey/infection_monkey/credential_repository/__init__.py b/monkey/infection_monkey/credential_repository/__init__.py index 62eae389b..f52bdb0c0 100644 --- a/monkey/infection_monkey/credential_repository/__init__.py +++ b/monkey/infection_monkey/credential_repository/__init__.py @@ -2,3 +2,6 @@ from .i_propagation_credentials_repository import IPropagationCredentialsReposit from .aggregating_propagation_credentials_repository import ( AggregatingPropagationCredentialsRepository, ) +from .add_credentials_from_event import ( + add_credentials_from_event_to_propagation_credentials_repository, +) diff --git a/monkey/infection_monkey/credential_repository/add_credentials_from_event.py b/monkey/infection_monkey/credential_repository/add_credentials_from_event.py new file mode 100644 index 000000000..123774581 --- /dev/null +++ b/monkey/infection_monkey/credential_repository/add_credentials_from_event.py @@ -0,0 +1,11 @@ +from common.events import CredentialsStolenEvent + +from . import IPropagationCredentialsRepository + + +class add_credentials_from_event_to_propagation_credentials_repository: + def __init__(self, credentials_repository: IPropagationCredentialsRepository): + self._credentials_repository = credentials_repository + + def __call__(self, event: CredentialsStolenEvent): + self._credentials_repository.add_credentials(event.stolen_credentials) diff --git a/vulture_allowlist.py b/vulture_allowlist.py index 8c0beb5ef..f547e8e5c 100644 --- a/vulture_allowlist.py +++ b/vulture_allowlist.py @@ -217,7 +217,7 @@ _event_queue # TODO DELETE IN #2176 CredentialsStolenEvent - +add_credentials_from_event_to_propagation_credentials_repository # TODO DELETE AFTER RESOURCE REFACTORING