Agent: Add additional debug logging to MSSQLExploiter

This commit is contained in:
Mike Salvatore 2022-06-13 16:52:19 -04:00
parent 133f7f5da1
commit 6db63d3c69
1 changed files with 7 additions and 0 deletions

View File

@ -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)