From 62005e6f8894df9a53cec17916549935b0a6c895 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 15 Mar 2022 08:41:23 -0400 Subject: [PATCH] Agent: Store MSSQLExploiter error message in self.exploit_result --- monkey/infection_monkey/exploit/mssqlexec.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index 0b18e824c..220268b76 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -89,10 +89,14 @@ class MSSQLExploiter(HostExploiter): self.remove_temp_dir() except Exception as e: - logger.error( - f"Unhandled exception occurred when trying " + error_message = ( + f"An unexpected error occurred when trying " f"to exploit MSSQL on host {self.host}: {e}" ) + + logger.error(error_message) + self.exploit_result.error_message = error_message + return self.exploit_result self.exploit_result.propagation_success = True