Agent: Fix LocketHTTPServer mypy error in MSSQLExploiter

This commit is contained in:
Ilija Lazoroski 2022-10-06 13:53:17 +02:00
parent 47846628e6
commit ec617df06a
1 changed files with 6 additions and 3 deletions

View File

@ -1,7 +1,7 @@
import logging
from pathlib import PureWindowsPath
from time import sleep, time
from typing import Iterable, Tuple
from typing import Iterable, Optional, Tuple
import pymssql
@ -171,9 +171,12 @@ class MSSQLExploiter(HostExploiter):
self._run_agent_download_command(agent_path_on_victim)
MSSQLExploiter._stop_agent_server(http_thread)
if http_thread:
MSSQLExploiter._stop_agent_server(http_thread)
def _start_agent_server(self, agent_path_on_victim: PureWindowsPath) -> LockedHTTPServer:
def _start_agent_server(
self, agent_path_on_victim: PureWindowsPath
) -> Optional[LockedHTTPServer]:
self.agent_http_path, http_thread = HTTPTools.create_locked_transfer(
self.host, str(agent_path_on_victim), self.agent_binary_repository
)