Hadoop bugfix, minor readability improvement

This commit is contained in:
VakarisZ 2020-05-20 17:20:07 +03:00
parent 5def120942
commit ca1ee90385
2 changed files with 5 additions and 4 deletions

View File

@ -325,9 +325,10 @@ class ControlClient(object):
return False return False
@staticmethod @staticmethod
def should_monkey_run(port: str) -> bool: def should_monkey_run(vulnerable_port: str) -> bool:
if WormConfiguration.get_hop_count() > 1 and \ if vulnerable_port and \
ControlClient.can_island_see_port(port) and \ WormConfiguration.get_hop_count() > 1 and \
ControlClient.can_island_see_port(vulnerable_port) and \
WormConfiguration.started_on_island: WormConfiguration.started_on_island:
raise PlannedShutdownException("Monkey shouldn't run on current machine " raise PlannedShutdownException("Monkey shouldn't run on current machine "
"(it will be exploited later with more depth).") "(it will be exploited later with more depth).")

View File

@ -74,7 +74,7 @@ class HadoopExploiter(WebRCE):
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,
vulnerable_port=HTTPTools.get_port_from_url(http_path)) vulnerable_port=HadoopExploiter.HADOOP_PORTS[0][0])
if 'linux' in self.host.os['type']: if 'linux' in self.host.os['type']:
base_command = HADOOP_LINUX_COMMAND base_command = HADOOP_LINUX_COMMAND
else: else: