From 33230e85f75bce9c8fa6197c99a70b8e3f66e7d5 Mon Sep 17 00:00:00 2001 From: Kekoa Kaaikala Date: Wed, 5 Oct 2022 12:51:59 +0000 Subject: [PATCH] Agent: Use updated publish methods --- monkey/infection_monkey/exploit/mssqlexec.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index fde399d10..6b4de1fc2 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -52,10 +52,12 @@ class MSSQLExploiter(HostExploiter): try: self.cursor = self._brute_force(self.host.ip_addr, self.SQL_DEFAULT_TCP_PORT, creds) except FailedExploitationError: - logger.info( + error_message = ( f"Failed brute-forcing of MSSQL server on {self.host}," f" no credentials were successful" ) + logger.error(error_message) + self._publish_exploitation_event(self.host.ip_addr, False, error_message=error_message) return self.exploit_result if self._is_interrupted(): @@ -72,12 +74,12 @@ class MSSQLExploiter(HostExploiter): ) logger.error(error_message) - self.publish_propagation_event(self.host.ip_addr, False, error_message=error_message) + self._publish_propagation_event(self.host.ip_addr, False, error_message=error_message) self.exploit_result.error_message = error_message return self.exploit_result - self.publish_propagation_event(self.host.ip_addr, True) + self._publish_propagation_event(self.host.ip_addr, True) self.exploit_result.propagation_success = True return self.exploit_result @@ -145,7 +147,7 @@ class MSSQLExploiter(HostExploiter): def _report_login_attempt( self, success: bool, host: str, user, password: str, message: str = "" ): - self.publish_exploitation_event(host, success, error_message=message) + self._publish_exploitation_event(host, success, error_message=message) self.report_login_attempt(success, user, password) def _upload_agent(self, agent_path_on_victim: PureWindowsPath):