Agent: Add _initialize_http_handler() to ExploitClassHTTPServer

This commit is contained in:
Mike Salvatore 2022-01-12 19:27:51 -05:00
parent 176177b8cb
commit 6fa1d20e6a
1 changed files with 8 additions and 4 deletions

View File

@ -31,13 +31,17 @@ class HTTPHandler(http.server.BaseHTTPRequestHandler):
class ExploitClassHTTPServer: class ExploitClassHTTPServer:
def __init__(self, ip: str, port: int, java_class: bytes, poll_interval: float = 0.5): 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}") logger.debug(f"The Java Exploit class will be served at {ip}:{port}")
self._class_downloaded = threading.Event()
HTTPHandler.java_class = java_class self._class_downloaded = threading.Event()
HTTPHandler.class_downloaded = self._class_downloaded self._poll_interval = poll_interval
self._initialize_http_handler(java_class)
self._server = http.server.HTTPServer((ip, port), HTTPHandler) 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): def run(self):
logger.debug("Starting ExploitClassHTTPServer") logger.debug("Starting ExploitClassHTTPServer")