Island: Remove try/except from MimikatzResultsEncryptor.encrypt()

Catching this exception was a workaround for an issue that was resolved
in PR #1508.
This commit is contained in:
Mike Salvatore 2021-10-05 12:12:38 -04:00
parent 849ced2334
commit e7fcf933b7
2 changed files with 5 additions and 10 deletions

View File

@ -16,6 +16,8 @@ class MimikatzCredentialCollector(object):
def cred_list_to_cred_dict(creds: List[WindowsCredentials]): def cred_list_to_cred_dict(creds: List[WindowsCredentials]):
cred_dict = {} cred_dict = {}
for cred in creds: for cred in creds:
# TODO: This should be handled by the island, not the agent. There is already similar
# code in monkey_island/cc/models/report/report_dal.py.
# Lets not use "." and "$" in keys, because it will confuse mongo. # Lets not use "." and "$" in keys, because it will confuse mongo.
# Ideally we should refactor island not to use a dict and simply parse credential list. # Ideally we should refactor island not to use a dict and simply parse credential list.
key = cred.username.replace(".", ",").replace("$", "") key = cred.username.replace(".", ",").replace("$", "")

View File

@ -14,16 +14,9 @@ class MimikatzResultsEncryptor(IFieldEncryptor):
def encrypt(results: dict) -> dict: def encrypt(results: dict) -> dict:
for _, credentials in results.items(): for _, credentials in results.items():
for secret_type in MimikatzResultsEncryptor.secret_types: for secret_type in MimikatzResultsEncryptor.secret_types:
try:
credentials[secret_type] = get_datastore_encryptor().encrypt( credentials[secret_type] = get_datastore_encryptor().encrypt(
credentials[secret_type] credentials[secret_type]
) )
except ValueError as e:
logger.error(
f"Failed encrypting sensitive field for "
f"user {credentials['username']}! Error: {e}"
)
credentials[secret_type] = get_datastore_encryptor().encrypt("")
return results return results
@staticmethod @staticmethod