From a1896de9c895db04c75822e6d169022a84d03867 Mon Sep 17 00:00:00 2001 From: Ilija Lazoroski Date: Wed, 27 Jul 2022 15:11:47 +0200 Subject: [PATCH] Island: Fix processing exploit credentials encrypt/decrypt --- .../attack/technique_reports/technique_report_tools.py | 4 ++-- .../monkey_island/cc/services/telemetry/processing/exploit.py | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/monkey/monkey_island/cc/services/attack/technique_reports/technique_report_tools.py b/monkey/monkey_island/cc/services/attack/technique_reports/technique_report_tools.py index a3798c12a..4e1025775 100644 --- a/monkey/monkey_island/cc/services/attack/technique_reports/technique_report_tools.py +++ b/monkey/monkey_island/cc/services/attack/technique_reports/technique_report_tools.py @@ -31,7 +31,7 @@ def censor_password(password, plain_chars=3, secret_chars=5): """ if not password: return "" - password = get_datastore_encryptor().decrypt(password) + password = get_datastore_encryptor().decrypt(password.encode()).decode() return password[0:plain_chars] + "*" * secret_chars @@ -45,5 +45,5 @@ def censor_hash(str_hash, plain_chars=5): """ if not str_hash: return "" - str_hash = get_datastore_encryptor().decrypt(str_hash) + str_hash = get_datastore_encryptor().decrypt(str_hash.encode()).decode() return str_hash[0:plain_chars] + " ..." diff --git a/monkey/monkey_island/cc/services/telemetry/processing/exploit.py b/monkey/monkey_island/cc/services/telemetry/processing/exploit.py index cc6bd2c03..b7b362a51 100644 --- a/monkey/monkey_island/cc/services/telemetry/processing/exploit.py +++ b/monkey/monkey_island/cc/services/telemetry/processing/exploit.py @@ -52,4 +52,6 @@ def encrypt_exploit_creds(telemetry_json): credential = attempts[i][field] if credential: # PowerShell exploiter's telem may have `None` here if len(credential) > 0: - attempts[i][field] = get_datastore_encryptor().encrypt(credential) + attempts[i][field] = ( + get_datastore_encryptor().encrypt(credential.encode()).decode() + )