diff --git a/monkey/infection_monkey/credential_repository/aggregating_propagation_credentials_repository.py b/monkey/infection_monkey/credential_repository/aggregating_propagation_credentials_repository.py index 054428d59..f347b901c 100644 --- a/monkey/infection_monkey/credential_repository/aggregating_propagation_credentials_repository.py +++ b/monkey/infection_monkey/credential_repository/aggregating_propagation_credentials_repository.py @@ -33,10 +33,18 @@ class AggregatingPropagationCredentialsRepository(IPropagationCredentialsReposit self._add_secret(credentials.secret) def _add_identity(self, identity: ICredentialComponent): + """ + Stores identity component to the repository + :param identity: Identity credential component + """ if identity.credential_type is CredentialComponentType.USERNAME: self._stored_credentials.setdefault("exploit_user_list", set()).add(identity.username) def _add_secret(self, secret: ICredentialComponent): + """ + Stores secret component to the repository + :param secret: Secret credential component + """ if secret.credential_type is CredentialComponentType.PASSWORD: self._stored_credentials.setdefault("exploit_password_list", set()).add(secret.password) elif secret.credential_type is CredentialComponentType.LM_HASH: @@ -61,9 +69,18 @@ class AggregatingPropagationCredentialsRepository(IPropagationCredentialsReposit @request_cache(CREDENTIALS_POLL_PERIOD_SEC) def _get_credentials_from_control_channel(self) -> Sequence[Credentials]: + """ + Fetches credentials from control channel + :return: Credentials that can be used for propagation + """ return self._control_channel.get_credentials_for_propagation() def _set_attribute(self, attribute_to_be_set: str, credentials_values: Iterable[Any]): + """ + Sets a value for a credential type + :param attribute_to_be_set: Key of self._stored_credentials (credential container key) + :param credentials_values: Value we want to set the container to + """ if not credentials_values: return diff --git a/monkey/infection_monkey/credential_repository/i_propagation_credentials_repository.py b/monkey/infection_monkey/credential_repository/i_propagation_credentials_repository.py index be110476f..7e5d20dab 100644 --- a/monkey/infection_monkey/credential_repository/i_propagation_credentials_repository.py +++ b/monkey/infection_monkey/credential_repository/i_propagation_credentials_repository.py @@ -10,7 +10,7 @@ class IPropagationCredentialsRepository(metaclass=abc.ABCMeta): def add_credentials(self, credentials_to_add: Iterable[Credentials]): """ Adds credentials to the CredentialStore - :param Iterable[Credentials] credentials: The credentials that will be added + :param Iterable[Credentials] credentials_to_add: The credentials that will be added """ @abc.abstractmethod