diff --git a/monkey/infection_monkey/exploit/hadoop.py b/monkey/infection_monkey/exploit/hadoop.py index f221ebe1f..f3fd7d095 100644 --- a/monkey/infection_monkey/exploit/hadoop.py +++ b/monkey/infection_monkey/exploit/hadoop.py @@ -27,7 +27,7 @@ from infection_monkey.utils.commands import build_monkey_commandline class HadoopExploiter(WebRCE): _TARGET_OS_TYPE = ["linux", "windows"] _EXPLOITED_SERVICE = "Hadoop" - HADOOP_PORTS = [["8088", False]] + HADOOP_PORTS = [("8088", False)] # How long we have our http server open for downloads in seconds DOWNLOAD_TIMEOUT = 60 # Random string's length that's used for creating unique app name @@ -38,7 +38,7 @@ class HadoopExploiter(WebRCE): def _exploit_host(self): # Try to get exploitable url - urls = self.build_potential_urls(self.HADOOP_PORTS) + urls = self.build_potential_urls(self.host.ip_addr, self.HADOOP_PORTS) self.add_vulnerable_urls(urls, True) if not self.vulnerable_urls: return False diff --git a/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py b/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py index 074779f59..f0a4f3e18 100644 --- a/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py +++ b/monkey/infection_monkey/exploit/log4shell_utils/ldap_server.py @@ -77,18 +77,14 @@ class LDAPExploitServer: ): """ :param ldap_server_port: The port that the LDAP server will listen on. - :type ldap_server_port: int :param http_server_ip: The IP address of the HTTP server that serves the malicious Log4Shell Java class. - :type http_server_ip: str :param http_server_port: The port the HTTP server is listening on. - :type ldap_server_port: int :param storage_dir: A directory where the LDAP server can safely store files it needs during runtime. - :type storage_dir: Path """ self._reactor_startup_completed = multiprocessing.Event() self._ldap_server_port = ldap_server_port @@ -173,7 +169,6 @@ class LDAPExploitServer: argument is None (the default), the method blocks until the LDAP server terminates. If `timeout` is a positive floating point number, this method blocks for at most `timeout` seconds. - :type timeout: float """ if self._server_process.is_alive(): logger.debug("Stopping LDAP exploit server") diff --git a/monkey/infection_monkey/exploit/web_rce.py b/monkey/infection_monkey/exploit/web_rce.py index 2be55ce3e..1396b095d 100644 --- a/monkey/infection_monkey/exploit/web_rce.py +++ b/monkey/infection_monkey/exploit/web_rce.py @@ -2,6 +2,7 @@ import logging import re from abc import abstractmethod from posixpath import join +from typing import List, Tuple from common.utils.attack_utils import BITS_UPLOAD_STRING, ScanStatus from infection_monkey.exploit.consts import WIN_ARCH_32, WIN_ARCH_64 @@ -100,7 +101,9 @@ class WebRCE(HostExploiter): if not ports: return False # Get urls to try to exploit - potential_urls = self.build_potential_urls(ports, exploit_config["url_extensions"]) + potential_urls = self.build_potential_urls( + self.host.ip_addr, ports, exploit_config["url_extensions"] + ) self.add_vulnerable_urls(potential_urls, exploit_config["stop_checking_urls"]) if not self.are_vulnerable_urls_sufficient(): @@ -220,7 +223,7 @@ class WebRCE(HostExploiter): return False @staticmethod - def build_potential_urls(ip: str, ports, extensions=None): + def build_potential_urls(ip: str, ports: List[Tuple[str, bool]], extensions=None): """ Build all possibly-vulnerable URLs on a specific host, based on the relevant ports and extensions.