From 522e62ad141a6354f2c06867f87c5140f1719ad4 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 14 Jun 2022 12:57:19 -0400 Subject: [PATCH] Agent: Refactor MSSQL create directory commands Use _run_mssql_command() and remove the dependency on MSSQLLimitedSizePayload. --- monkey/infection_monkey/exploit/mssqlexec.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index fd554504b..cb09c79fc 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -103,10 +103,9 @@ class MSSQLExploiter(HostExploiter): 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) + + mkdir_command = f"mkdir {MSSQLExploiter.TMP_DIR_PATH}" + self._run_mssql_command(mkdir_command) def run_mssql_command(self, mssql_command): array_of_commands = mssql_command.split_into_array_of_smaller_payloads()