Skip to content

Commit

Permalink
Agent: Fix LocketHTTPServer mypy error in MSSQLExploiter
Browse files Browse the repository at this point in the history
  • Loading branch information
ilija-lazoroski committed Oct 6, 2022
1 parent 4784662 commit ec617df
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions monkey/infection_monkey/exploit/mssqlexec.py
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -171,9 +171,12 @@ def _upload_agent(self, agent_path_on_victim: PureWindowsPath):

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
)
Expand Down

0 comments on commit ec617df

Please sign in to comment.