Agent: Use issintance instead of type comparison in credential repo

This commit is contained in:
vakaris_zilius 2022-09-06 13:06:03 +00:00
parent 792895a25c
commit 233090942a
1 changed files with 4 additions and 4 deletions

View File

@ -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}],