From 6db63d3c69cc1879d9ca07e41f00dac5a4b0448f Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Mon, 13 Jun 2022 16:52:19 -0400 Subject: [PATCH] Agent: Add additional debug logging to MSSQLExploiter --- monkey/infection_monkey/exploit/mssqlexec.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index 526c85caa..b519ee422 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -113,12 +113,14 @@ class MSSQLExploiter(HostExploiter): return self.run_mssql_command(file_running_command) def create_temp_dir(self): + logger.debug(f"Creating a temporary directory: {MSSQLExploiter.TMP_DIR_PATH}") dir_creation_command = MSSQLLimitedSizePayload( command="mkdir {}".format(MSSQLExploiter.TMP_DIR_PATH) ) self.run_mssql_command(dir_creation_command) def create_empty_payload_file(self): + logger.debug(f"Creating an empty payload file: {self.payload_file_path}") suffix = MSSQLExploiter.CREATE_COMMAND_SUFFIX.format( payload_file_path=self.payload_file_path ) @@ -133,11 +135,16 @@ class MSSQLExploiter(HostExploiter): def run_monkey(self, monkey_path_on_victim: PurePath): monkey_launch_command = self.get_monkey_launch_command(monkey_path_on_victim) + logger.debug( + f"Launching the agent: {monkey_launch_command.prefix} -- " + f"{monkey_launch_command.command} -- {monkey_launch_command.suffix}" + ) self.run_mssql_command(monkey_launch_command) self.run_payload_file() def run_mssql_commands(self, cmds): for cmd in cmds: + logger.debug(f"Running command on SQL Server: {cmd}") self.cursor.execute(cmd) sleep(MSSQLExploiter.QUERY_BUFFER)