From c2f3042442a893d63196c454127223e6dd1d0f79 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 12 Jan 2022 16:46:31 -0500 Subject: [PATCH] Agent: Move definition of exploit template constants for log4shell The LINUX_EXPLOIT_TEMPLATE_PATH and WINDOWS_EXPLOIT_TEMPLATE_PATH are not used in exploit_builder.py, and therefore have no reason to be defined in this file. They are now defined in the __init__.py --- monkey/infection_monkey/exploit/log4shell_utils/__init__.py | 6 ++++-- .../exploit/log4shell_utils/exploit_builder.py | 2 -- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/exploit/log4shell_utils/__init__.py b/monkey/infection_monkey/exploit/log4shell_utils/__init__.py index 68de2d192..831ddec48 100644 --- a/monkey/infection_monkey/exploit/log4shell_utils/__init__.py +++ b/monkey/infection_monkey/exploit/log4shell_utils/__init__.py @@ -1,9 +1,11 @@ +from pathlib import Path from .exploit_builder import ( build_exploit_bytecode, InvalidExploitTemplateError, - LINUX_EXPLOIT_TEMPLATE_PATH, - WINDOWS_EXPLOIT_TEMPLATE_PATH, ) from .ldap_server import LDAPExploitServer from .service_exploiters import get_log4shell_service_exploiters from .exploit_class_http_server import ExploitClassHTTPServer + +LINUX_EXPLOIT_TEMPLATE_PATH = Path(__file__).parent / "LinuxExploit.class.template" +WINDOWS_EXPLOIT_TEMPLATE_PATH = Path(__file__).parent / "WindowsExploit.class.template" diff --git a/monkey/infection_monkey/exploit/log4shell_utils/exploit_builder.py b/monkey/infection_monkey/exploit/log4shell_utils/exploit_builder.py index 831ddfc05..40b6d8bd4 100644 --- a/monkey/infection_monkey/exploit/log4shell_utils/exploit_builder.py +++ b/monkey/infection_monkey/exploit/log4shell_utils/exploit_builder.py @@ -3,8 +3,6 @@ from pathlib import Path # This code has been adapted from https://github.com/alexandre-lavoie/python-log4rce -LINUX_EXPLOIT_TEMPLATE_PATH = Path(__file__).parent / "LinuxExploit.class.template" -WINDOWS_EXPLOIT_TEMPLATE_PATH = Path(__file__).parent / "WindowsExploit.class.template" INJECTION_TAG = "###"