Agent: Refactor MSSQL cleanup commands

* Simplify!
    * Remove the dependency on MSSQLLimitedSizePayload.
    * Use f-strings
This commit is contained in:
Mike Salvatore 2022-06-14 12:43:06 -04:00
parent 257c6b0b05
commit b2aa8333c3
1 changed files with 2 additions and 9 deletions

View File

@ -136,15 +136,8 @@ class MSSQLExploiter(HostExploiter):
self.run_payload_file()
def remove_temp_dir(self):
# Remove temporary dir we stored payload at
tmp_file_removal_command = MSSQLLimitedSizePayload(
command="del {}".format(self.payload_file_path)
)
self.run_mssql_command(tmp_file_removal_command)
tmp_dir_removal_command = MSSQLLimitedSizePayload(
command="rmdir {}".format(MSSQLExploiter.TMP_DIR_PATH)
)
self.run_mssql_command(tmp_dir_removal_command)
self._run_mssql_command(f"del {self.payload_file_path}")
self._run_mssql_command(f"rmdir {MSSQLExploiter.TMP_DIR_PATH}")
def start_monkey_server(self, monkey_path_on_victim: PureWindowsPath) -> LockedHTTPServer:
self.agent_http_path, http_thread = HTTPTools.create_locked_transfer(