diff --git a/monkey/infection_monkey/exploit/hadoop.py b/monkey/infection_monkey/exploit/hadoop.py index 318e37d67..15e801452 100644 --- a/monkey/infection_monkey/exploit/hadoop.py +++ b/monkey/infection_monkey/exploit/hadoop.py @@ -12,7 +12,7 @@ import string import requests from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT -from infection_monkey.exploit.tools.helpers import get_agent_dest_path +from infection_monkey.exploit.tools.helpers import get_agent_dst_path from infection_monkey.exploit.tools.http_tools import HTTPTools from infection_monkey.exploit.web_rce import WebRCE from infection_monkey.model import ( @@ -43,7 +43,7 @@ class HadoopExploiter(WebRCE): return self.exploit_result try: - monkey_path_on_victim = get_agent_dest_path(self.host) + monkey_path_on_victim = get_agent_dst_path(self.host) except KeyError: return self.exploit_result diff --git a/monkey/infection_monkey/exploit/log4shell.py b/monkey/infection_monkey/exploit/log4shell.py index b59c72dd4..198635976 100644 --- a/monkey/infection_monkey/exploit/log4shell.py +++ b/monkey/infection_monkey/exploit/log4shell.py @@ -12,7 +12,7 @@ from infection_monkey.exploit.log4shell_utils import ( build_exploit_bytecode, get_log4shell_service_exploiters, ) -from infection_monkey.exploit.tools.helpers import get_agent_dest_path +from infection_monkey.exploit.tools.helpers import get_agent_dst_path from infection_monkey.exploit.tools.http_tools import HTTPTools from infection_monkey.exploit.web_rce import WebRCE from infection_monkey.i_puppet.i_puppet import ExploiterResultData @@ -61,7 +61,7 @@ class Log4ShellExploiter(WebRCE): self._agent_http_server_thread = None def _start_servers(self): - target_path = get_agent_dest_path(self.host) + target_path = get_agent_dst_path(self.host) # Start http server, to serve agent to victims agent_http_path = self._start_agent_http_server(target_path) diff --git a/monkey/infection_monkey/exploit/mssqlexec.py b/monkey/infection_monkey/exploit/mssqlexec.py index 147403580..526c85caa 100644 --- a/monkey/infection_monkey/exploit/mssqlexec.py +++ b/monkey/infection_monkey/exploit/mssqlexec.py @@ -8,7 +8,7 @@ import pymssql from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT from common.utils.exceptions import FailedExploitationError from infection_monkey.exploit.HostExploiter import HostExploiter -from infection_monkey.exploit.tools.helpers import get_agent_dest_path +from infection_monkey.exploit.tools.helpers import get_agent_dst_path from infection_monkey.exploit.tools.http_tools import HTTPTools from infection_monkey.exploit.tools.payload_parsing import LimitedSizePayload from infection_monkey.i_puppet import ExploiterResultData @@ -59,7 +59,7 @@ class MSSQLExploiter(HostExploiter): Also, don't forget to start_monkey_server() before self.upload_monkey() and self.stop_monkey_server() after """ - monkey_path_on_victim = get_agent_dest_path(self.host) + monkey_path_on_victim = get_agent_dst_path(self.host) # Brute force to get connection creds = generate_identity_secret_pairs( diff --git a/monkey/infection_monkey/exploit/powershell.py b/monkey/infection_monkey/exploit/powershell.py index 16073a014..7b33df9ed 100644 --- a/monkey/infection_monkey/exploit/powershell.py +++ b/monkey/infection_monkey/exploit/powershell.py @@ -13,7 +13,7 @@ from infection_monkey.exploit.powershell_utils.powershell_client import ( IPowerShellClient, PowerShellClient, ) -from infection_monkey.exploit.tools.helpers import get_agent_dest_path, get_random_file_suffix +from infection_monkey.exploit.tools.helpers import get_agent_dst_path, get_random_file_suffix from infection_monkey.model import DROPPER_ARG, RUN_MONKEY, VictimHost from infection_monkey.utils.commands import build_monkey_commandline from infection_monkey.utils.environment import is_windows_os @@ -134,7 +134,7 @@ class PowerShellExploiter(HostExploiter): raise ValueError(f"Unknown secret type {credentials.secret_type}") def _execute_monkey_agent_on_victim(self): - monkey_path_on_victim = get_agent_dest_path(self.host) + monkey_path_on_victim = get_agent_dst_path(self.host) self._copy_monkey_binary_to_victim(monkey_path_on_victim) logger.info("Successfully copied the monkey binary to the victim.") diff --git a/monkey/infection_monkey/exploit/smbexec.py b/monkey/infection_monkey/exploit/smbexec.py index 825cb37ce..03b6bfb3e 100644 --- a/monkey/infection_monkey/exploit/smbexec.py +++ b/monkey/infection_monkey/exploit/smbexec.py @@ -6,7 +6,7 @@ from impacket.dcerpc.v5.scmr import DCERPCSessionError from common.common_consts.timeouts import LONG_REQUEST_TIMEOUT from common.utils.attack_utils import ScanStatus, UsageEnum from infection_monkey.exploit.HostExploiter import HostExploiter -from infection_monkey.exploit.tools.helpers import get_agent_dest_path +from infection_monkey.exploit.tools.helpers import get_agent_dst_path from infection_monkey.exploit.tools.smb_tools import SmbTools from infection_monkey.model import DROPPER_CMDLINE_DETACHED_WINDOWS, MONKEY_CMDLINE_DETACHED_WINDOWS from infection_monkey.telemetry.attack.t1035_telem import T1035Telem @@ -31,7 +31,7 @@ class SMBExploiter(HostExploiter): def _exploit_host(self): agent_binary = self.agent_repository.get_agent_binary(self.host.os["type"]) - dest_path = get_agent_dest_path(self.host) + dest_path = get_agent_dst_path(self.host) creds = generate_brute_force_combinations(self.options["credentials"]) for user, password, lm_hash, ntlm_hash in interruptible_iter(creds, self.interrupt): diff --git a/monkey/infection_monkey/exploit/sshexec.py b/monkey/infection_monkey/exploit/sshexec.py index 7f9619e95..f76147fd1 100644 --- a/monkey/infection_monkey/exploit/sshexec.py +++ b/monkey/infection_monkey/exploit/sshexec.py @@ -9,7 +9,7 @@ from common.utils import Timer from common.utils.attack_utils import ScanStatus from common.utils.exceptions import FailedExploitationError from infection_monkey.exploit.HostExploiter import HostExploiter -from infection_monkey.exploit.tools.helpers import get_agent_dest_path +from infection_monkey.exploit.tools.helpers import get_agent_dst_path from infection_monkey.i_puppet import ExploiterResultData from infection_monkey.model import MONKEY_ARG from infection_monkey.network.tools import check_tcp_port, get_interface_to_target @@ -209,7 +209,7 @@ class SSHExploiter(HostExploiter): self._set_interrupted() return self.exploit_result - monkey_path_on_victim = get_agent_dest_path(self.host) + monkey_path_on_victim = get_agent_dst_path(self.host) try: with ssh.open_sftp() as ftp: diff --git a/monkey/infection_monkey/exploit/tools/helpers.py b/monkey/infection_monkey/exploit/tools/helpers.py index 17d76607a..8334f33a6 100644 --- a/monkey/infection_monkey/exploit/tools/helpers.py +++ b/monkey/infection_monkey/exploit/tools/helpers.py @@ -14,7 +14,7 @@ AGENT_BINARY_PATH_LINUX = "/tmp/monkey" AGENT_BINARY_PATH_WIN64 = r"C:\Windows\temp\monkey64.exe" -def get_agent_dest_path(host: VictimHost) -> PurePath: +def get_agent_dst_path(host: VictimHost) -> PurePath: if host.os["type"] == "windows": path = PureWindowsPath(AGENT_BINARY_PATH_WIN64) else: diff --git a/monkey/infection_monkey/exploit/wmiexec.py b/monkey/infection_monkey/exploit/wmiexec.py index 50f8deb6b..b8d577365 100644 --- a/monkey/infection_monkey/exploit/wmiexec.py +++ b/monkey/infection_monkey/exploit/wmiexec.py @@ -6,7 +6,7 @@ import traceback from impacket.dcerpc.v5.rpcrt import DCERPCException from infection_monkey.exploit.HostExploiter import HostExploiter -from infection_monkey.exploit.tools.helpers import get_agent_dest_path +from infection_monkey.exploit.tools.helpers import get_agent_dst_path from infection_monkey.exploit.tools.smb_tools import SmbTools from infection_monkey.exploit.tools.wmi_tools import AccessDeniedException, WmiTools from infection_monkey.i_puppet import ExploiterResultData @@ -74,7 +74,7 @@ class WmiExploiter(HostExploiter): self._set_interrupted() return self.exploit_result - target_path = get_agent_dest_path(self.host) + target_path = get_agent_dst_path(self.host) remote_full_path = SmbTools.copy_file( self.host, diff --git a/monkey/tests/unit_tests/infection_monkey/exploit/tools/test_helpers.py b/monkey/tests/unit_tests/infection_monkey/exploit/tools/test_helpers.py index 68cba4598..a339ec17f 100644 --- a/monkey/tests/unit_tests/infection_monkey/exploit/tools/test_helpers.py +++ b/monkey/tests/unit_tests/infection_monkey/exploit/tools/test_helpers.py @@ -6,7 +6,7 @@ from infection_monkey.exploit.tools.helpers import ( AGENT_BINARY_PATH_LINUX, AGENT_BINARY_PATH_WIN64, RAND_SUFFIX_LEN, - get_agent_dest_path, + get_agent_dst_path, ) @@ -19,27 +19,27 @@ def _get_host(os): @pytest.mark.parametrize( "os, path", [("linux", AGENT_BINARY_PATH_LINUX), ("windows", AGENT_BINARY_PATH_WIN64)] ) -def test_get_agent_dest_path(os, path): +def test_get_agent_dst_path(os, path): host = _get_host(os) - rand_path = get_agent_dest_path(host) + rand_path = get_agent_dst_path(host) # Assert that filename got longer by RAND_SUFFIX_LEN and one dash assert len(str(rand_path)) == (len(str(path)) + RAND_SUFFIX_LEN + 1) -def test_get_agent_dest_path_randomness(): +def test_get_agent_dst_path_randomness(): host = _get_host("windows") - path1 = get_agent_dest_path(host) - path2 = get_agent_dest_path(host) + path1 = get_agent_dst_path(host) + path2 = get_agent_dst_path(host) assert path1 != path2 -def test_get_agent_dest_path_str_place(): +def test_get_agent_dst_path_str_place(): host = _get_host("windows") - rand_path = get_agent_dest_path(host) + rand_path = get_agent_dst_path(host) assert str(rand_path).startswith(r"C:\Windows\temp\monkey") assert str(rand_path).endswith(".exe")