Agent: Set client parameters if password is "" in PowerShellExploiter
This commit is contained in:
parent
fb18c1cbd4
commit
8209fa55df
|
@ -89,11 +89,18 @@ class PowerShellExploiter(HostExploiter):
|
|||
return [credentials for credentials in self._config.get_exploit_user_password_pairs()]
|
||||
|
||||
def _authenticate(self, username: Optional[str], password: Optional[str]) -> Client:
|
||||
ssl = password != ""
|
||||
auth = "negotiate" if password != "" else "basic"
|
||||
encryption = "auto" if password != "" else "never"
|
||||
|
||||
with Client(
|
||||
self.host.ip_addr,
|
||||
username=username,
|
||||
password=password,
|
||||
cert_validation=False,
|
||||
ssl=ssl,
|
||||
auth=auth,
|
||||
encryption=encryption,
|
||||
) as client:
|
||||
# attempt to execute dir command to know if authentication was successful
|
||||
client.execute_cmd("dir")
|
||||
|
|
Loading…
Reference in New Issue