How to use the pypsrp.encryption.WinRMEncryption function in pypsrp

To help you get started, we’ve selected a few pypsrp examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jborean93 / pypsrp / tests / test_transport.py View on Github external
def test_build_kerberos_with_kwargs(self):
        transport = TransportHTTP("", auth="kerberos", username="user",
                                  ssl=False, password="pass",
                                  negotiate_delegate=True,
                                  negotiate_hostname_override="host",
                                  negotiate_send_cbt=False,
                                  negotiate_service="HTTP")
        session = transport._build_session()
        assert isinstance(transport.encryption, WinRMEncryption)
        assert transport.encryption.protocol == WinRMEncryption.SPNEGO
        assert isinstance(session.auth, HTTPNegotiateAuth)
        assert session.auth.auth_provider == "kerberos"
        assert session.auth.delegate is True
        assert session.auth.hostname_override == "host"
        assert session.auth.password == "pass"
        assert session.auth.send_cbt is False
        assert session.auth.service == 'HTTP'
        assert session.auth.username == "user"
        assert session.auth.wrap_required is True
github jborean93 / pypsrp / tests / test_transport.py View on Github external
def test_build_credssp_no_kwargs(self):
        credssp = pytest.importorskip("requests_credssp")

        transport = TransportHTTP("", username="user", password="pass",
                                  auth="credssp")
        session = transport._build_session()
        assert isinstance(transport.encryption, WinRMEncryption)
        assert transport.encryption.protocol == WinRMEncryption.CREDSSP
        assert isinstance(session.auth, credssp.HttpCredSSPAuth)
        assert session.auth.auth_mechanism == 'auto'
        assert session.auth.disable_tlsv1_2 is False
        assert session.auth.minimum_version == 2
        assert session.auth.password == 'pass'
        assert session.auth.username == 'user'
github jborean93 / pypsrp / tests / test_wsman.py View on Github external
def test_build_credssp_with_kwargs(self):
        credssp = pytest.importorskip("requests_credssp")

        transport = _TransportHTTP("", username="user", password="pass",
                                   auth="credssp",
                                   credssp_auth_mechanism="kerberos",
                                   credssp_disable_tlsv1_2=True,
                                   credssp_minimum_version=5)

        session = transport._build_session()
        assert isinstance(transport.encryption, WinRMEncryption)
        assert transport.encryption.protocol == WinRMEncryption.CREDSSP
        assert isinstance(session.auth, credssp.HttpCredSSPAuth)
        assert session.auth.auth_mechanism == 'kerberos'
        assert session.auth.disable_tlsv1_2 is True
        assert session.auth.minimum_version == 5
        assert session.auth.password == 'pass'
        assert session.auth.username == 'user'
github jborean93 / pypsrp / tests / test_wsman.py View on Github external
def test_build_credssp_no_kwargs(self):
        credssp = pytest.importorskip("requests_credssp")

        transport = _TransportHTTP("", username="user", password="pass",
                                   auth="credssp")
        session = transport._build_session()
        assert isinstance(transport.encryption, WinRMEncryption)
        assert transport.encryption.protocol == WinRMEncryption.CREDSSP
        assert isinstance(session.auth, credssp.HttpCredSSPAuth)
        assert session.auth.auth_mechanism == 'auto'
        assert session.auth.disable_tlsv1_2 is False
        assert session.auth.minimum_version == 2
        assert session.auth.password == 'pass'
        assert session.auth.username == 'user'
github jborean93 / pypsrp / pypsrp / transport.py View on Github external
if not HAS_CREDSSP:
            raise ImportError("Cannot use CredSSP auth as requests-credssp is "
                              "not installed: %s" % str(CREDSSP_IMP_ERR))

        if self.username is None:
            raise ValueError("For credssp auth, the username must be "
                             "specified")
        if self.password is None:
            raise ValueError("For credssp auth, the password must be "
                             "specified")

        kwargs = self._get_auth_kwargs('credssp')
        session.auth = HttpCredSSPAuth(username=self.username,
                                       password=self.password,
                                       **kwargs)
        self.encryption = WinRMEncryption(
            session.auth, WinRMEncryption.CREDSSP
        )
github jborean93 / pypsrp / pypsrp / transport.py View on Github external
def _build_auth_negotiate(self, session, auth_provider="auto"):
        kwargs = self._get_auth_kwargs('negotiate')

        session.auth = HTTPNegotiateAuth(username=self.username,
                                         password=self.password,
                                         auth_provider=auth_provider,
                                         wrap_required=self.wrap_required,
                                         **kwargs)
        self.encryption = WinRMEncryption(
            session.auth, WinRMEncryption.SPNEGO
        )
github jborean93 / pypsrp / pypsrp / wsman.py View on Github external
if not HAS_CREDSSP:
            raise ImportError("Cannot use CredSSP auth as requests-credssp is "
                              "not installed: %s" % str(CREDSSP_IMP_ERR))

        if self.username is None:
            raise ValueError("For credssp auth, the username must be "
                             "specified")
        if self.password is None:
            raise ValueError("For credssp auth, the password must be "
                             "specified")

        kwargs = self._get_auth_kwargs('credssp')
        session.auth = HttpCredSSPAuth(username=self.username,
                                       password=self.password,
                                       **kwargs)
        self.encryption = WinRMEncryption(
            session.auth, WinRMEncryption.CREDSSP
        )
github jborean93 / pypsrp / pypsrp / wsman.py View on Github external
def _build_auth_negotiate(self, session, auth_provider="auto"):
        kwargs = self._get_auth_kwargs('negotiate')

        session.auth = HTTPNegotiateAuth(username=self.username,
                                         password=self.password,
                                         auth_provider=auth_provider,
                                         wrap_required=self.wrap_required,
                                         **kwargs)
        self.encryption = WinRMEncryption(
            session.auth, WinRMEncryption.SPNEGO
        )
github jborean93 / pypsrp / pypsrp / transport.py View on Github external
def _build_auth_negotiate(self, session, auth_provider="auto"):
        kwargs = self._get_auth_kwargs('negotiate')

        session.auth = HTTPNegotiateAuth(username=self.username,
                                         password=self.password,
                                         auth_provider=auth_provider,
                                         wrap_required=self.wrap_required,
                                         **kwargs)
        self.encryption = WinRMEncryption(
            session.auth, WinRMEncryption.SPNEGO
        )