Agent: Improve MSSQL command logging

This commit is contained in:
Mike Salvatore 2022-06-15 08:45:56 -04:00
parent 95acfc36ad
commit 4e71f4b6e4
1 changed files with 4 additions and 2 deletions

View File

@ -158,9 +158,11 @@ class MSSQLExploiter(HostExploiter):
self._run_mssql_command(agent_download_command)
def _run_mssql_command(self, command: str):
logger.debug(f"Running command on SQL Server: {command}")
sql_server_command = f"xp_cmdshell '{command}'"
self.cursor.execute(f"xp_cmdshell '{command}'")
logger.debug(f"Running command on SQL Server: {sql_server_command}")
self.cursor.execute(sql_server_command)
self.add_executed_cmd(command)
sleep(MSSQLExploiter.QUERY_BUFFER)