Agent: Rename function for returning ExploiterResultData

This commit is contained in:
Shreya Malviya 2022-02-23 17:11:53 +05:30
parent 6cdb86aa4b
commit 4ecc5283e5
2 changed files with 9 additions and 9 deletions

View File

@ -127,7 +127,7 @@ class HostExploiter:
powershell = True if "powershell" in cmd.lower() else False
self.exploit_info["executed_cmds"].append({"cmd": cmd, "powershell": powershell})
def get_exploit_result_data(self) -> ExploiterResultData:
def return_exploit_result_data(self) -> ExploiterResultData:
return ExploiterResultData(
self.exploit_result["exploitation_success"],
self.exploit_result["propagation_success"],

View File

@ -114,7 +114,7 @@ class SSHExploiter(HostExploiter):
self.exploit_result["error_message"] = f"SSH port is closed on {self.host}, skipping"
logger.info(self.exploit_result["error_message"])
return self.get_exploit_result_data()
return self.return_exploit_result_data()
try:
ssh = self.exploit_with_ssh_keys(port)
@ -129,7 +129,7 @@ class SSHExploiter(HostExploiter):
self.exploit_result["propagation_success"] = False
logger.debug(self.exploit_result["error_message"])
return self.get_exploit_result_data()
return self.return_exploit_result_data()
if not self.host.os.get("type"):
try:
@ -143,7 +143,7 @@ class SSHExploiter(HostExploiter):
if not uname_os:
logger.error(self.exploit_result["error_message"])
return self.get_exploit_result_data()
return self.return_exploit_result_data()
except Exception as exc:
self.exploit_result["propagation_success"] = False
self.exploit_result[
@ -151,7 +151,7 @@ class SSHExploiter(HostExploiter):
] = f"Error running uname os command on victim {self.host}: ({exc})"
logger.debug(self.exploit_result["error_message"])
return self.get_exploit_result_data()
return self.return_exploit_result_data()
if not self.host.os.get("machine"):
try:
@ -174,7 +174,7 @@ class SSHExploiter(HostExploiter):
] = f"Can't find suitable monkey executable for host {self.host}"
logger.info(self.exploit_result["error_message"])
return self.get_exploit_result_data()
return self.return_exploit_result_data()
try:
ftp = ssh.open_sftp()
@ -211,7 +211,7 @@ class SSHExploiter(HostExploiter):
)
)
if status == ScanStatus.SCANNED:
return self.get_exploit_result_data()
return self.return_exploit_result_data()
try:
cmdline = "%s %s" % (self.options["dropper_target_path_linux"], MONKEY_ARG)
@ -230,7 +230,7 @@ class SSHExploiter(HostExploiter):
ssh.close()
self.add_executed_cmd(cmdline)
return self.get_exploit_result_data()
return self.return_exploit_result_data()
except Exception as exc:
self.exploit_result["propagation_success"] = False
@ -239,4 +239,4 @@ class SSHExploiter(HostExploiter):
] = f"Error running monkey on victim {self.host}: ({exc})"
logger.error(self.exploit_result["error_message"])
return self.get_exploit_result_data()
return self.return_exploit_result_data()