forked from p34709852/monkey
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:
parent
849ced2334
commit
e7fcf933b7
|
@ -16,6 +16,8 @@ class MimikatzCredentialCollector(object):
|
|||
def cred_list_to_cred_dict(creds: List[WindowsCredentials]):
|
||||
cred_dict = {}
|
||||
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.
|
||||
# Ideally we should refactor island not to use a dict and simply parse credential list.
|
||||
key = cred.username.replace(".", ",").replace("$", "")
|
||||
|
|
|
@ -14,16 +14,9 @@ class MimikatzResultsEncryptor(IFieldEncryptor):
|
|||
def encrypt(results: dict) -> dict:
|
||||
for _, credentials in results.items():
|
||||
for secret_type in MimikatzResultsEncryptor.secret_types:
|
||||
try:
|
||||
credentials[secret_type] = get_datastore_encryptor().encrypt(
|
||||
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("")
|
||||
credentials[secret_type] = get_datastore_encryptor().encrypt(
|
||||
credentials[secret_type]
|
||||
)
|
||||
return results
|
||||
|
||||
@staticmethod
|
||||
|
|
Loading…
Reference in New Issue