Skip to content

Commit

Permalink
Island: Remove try/except from MimikatzResultsEncryptor.encrypt()
Browse files Browse the repository at this point in the history
Catching this exception was a workaround for an issue that was resolved
in PR #1508.
  • Loading branch information
mssalvatore committed Oct 5, 2021
1 parent 849ced2 commit e7fcf93
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ def get_creds():
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("$", "")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit e7fcf93

Please sign in to comment.