From 233090942a92356d05a786fdfb15ca1e7001d34b Mon Sep 17 00:00:00 2001 From: vakaris_zilius Date: Tue, 6 Sep 2022 13:06:03 +0000 Subject: [PATCH] Agent: Use issintance instead of type comparison in credential repo --- .../aggregating_propagation_credentials_repository.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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 c0bb669c6..cffa2b277 100644 --- a/monkey/infection_monkey/credential_repository/aggregating_propagation_credentials_repository.py +++ b/monkey/infection_monkey/credential_repository/aggregating_propagation_credentials_repository.py @@ -49,13 +49,13 @@ class AggregatingPropagationCredentialsRepository(IPropagationCredentialsReposit self._stored_credentials.setdefault("exploit_user_list", set()).add(identity.username) def _add_secret(self, secret: Secret): - if type(secret) is Password: + if isinstance(secret, Password): self._stored_credentials.setdefault("exploit_password_list", set()).add(secret.password) - elif type(secret) is LMHash: + elif isinstance(secret, LMHash): self._stored_credentials.setdefault("exploit_lm_hash_list", set()).add(secret.lm_hash) - elif type(secret) is NTHash: + elif isinstance(secret, NTHash): self._stored_credentials.setdefault("exploit_ntlm_hash_list", set()).add(secret.nt_hash) - elif type(secret) is SSHKeypair: + elif isinstance(secret, SSHKeypair): self._set_attribute( "exploit_ssh_keys", [{"public_key": secret.public_key, "private_key": secret.private_key}],