forked from p15670423/monkey
Agent: Reduce code duplication in _try_http(s)() methods
This commit is contained in:
parent
d30a8b007a
commit
61c6bf2567
|
@ -94,27 +94,23 @@ class PowerShellExploiter(HostExploiter):
|
||||||
raise PowerShellRemotingDisabledError("Powershell remoting seems to be disabled.")
|
raise PowerShellRemotingDisabledError("Powershell remoting seems to be disabled.")
|
||||||
|
|
||||||
def _try_http(self):
|
def _try_http(self):
|
||||||
credentials = Credentials(
|
self._try_ssl_login(self, use_ssl=False)
|
||||||
username=self._config.exploit_user_list[0],
|
|
||||||
password=self._config.exploit_password_list[0],
|
|
||||||
)
|
|
||||||
auth_options = AuthOptions(
|
|
||||||
auth_type=AUTH_NEGOTIATE,
|
|
||||||
encryption=ENCRYPTION_AUTO,
|
|
||||||
ssl=False,
|
|
||||||
)
|
|
||||||
self._authenticate(credentials, auth_options)
|
|
||||||
|
|
||||||
def _try_https(self):
|
def _try_https(self):
|
||||||
|
self._try_ssl_login(self, use_ssl=True)
|
||||||
|
|
||||||
|
def _try_ssl_login(self, use_ssl: bool):
|
||||||
credentials = Credentials(
|
credentials = Credentials(
|
||||||
username=self._config.exploit_user_list[0],
|
username=self._config.exploit_user_list[0],
|
||||||
password=self._config.exploit_password_list[0],
|
password=self._config.exploit_password_list[0],
|
||||||
)
|
)
|
||||||
|
|
||||||
auth_options = AuthOptions(
|
auth_options = AuthOptions(
|
||||||
auth_type=AUTH_NEGOTIATE,
|
auth_type=AUTH_NEGOTIATE,
|
||||||
encryption=ENCRYPTION_AUTO,
|
encryption=ENCRYPTION_AUTO,
|
||||||
ssl=True,
|
ssl=use_ssl,
|
||||||
)
|
)
|
||||||
|
|
||||||
self._authenticate(credentials, auth_options)
|
self._authenticate(credentials, auth_options)
|
||||||
|
|
||||||
def _authenticate_via_brute_force(
|
def _authenticate_via_brute_force(
|
||||||
|
|
Loading…
Reference in New Issue