diff --git a/monkey/infection_monkey/exploit/log4shell_utils/exploit_class_http_server.py b/monkey/infection_monkey/exploit/log4shell_utils/exploit_class_http_server.py index ba72412b4..cabfb74ff 100644 --- a/monkey/infection_monkey/exploit/log4shell_utils/exploit_class_http_server.py +++ b/monkey/infection_monkey/exploit/log4shell_utils/exploit_class_http_server.py @@ -31,13 +31,17 @@ class HTTPHandler(http.server.BaseHTTPRequestHandler): class ExploitClassHTTPServer: def __init__(self, ip: str, port: int, java_class: bytes, poll_interval: float = 0.5): logger.debug(f"The Java Exploit class will be served at {ip}:{port}") - self._class_downloaded = threading.Event() - HTTPHandler.java_class = java_class - HTTPHandler.class_downloaded = self._class_downloaded + self._class_downloaded = threading.Event() + self._poll_interval = poll_interval + + self._initialize_http_handler(java_class) self._server = http.server.HTTPServer((ip, port), HTTPHandler) - self._poll_interval = poll_interval + + def _initialize_http_handler(self, java_class: bytes): + HTTPHandler.java_class = java_class + HTTPHandler.class_downloaded = self._class_downloaded def run(self): logger.debug("Starting ExploitClassHTTPServer")