def get_credential(self): t = MSLDAPCredential( domain=self.domain, username=self.username, password = self.password, auth_method=self.auth_scheme, settings = self.auth_settings ) t.encrypt = self.encrypt t.etypes = self.etypes return t
def get_ldap_cred(self, authtype: LDAPAuthProtocol, target: MSLDAPTarget = None, settings: dict = None): secret = None if self.krb_rc4_hmac is not None: secret = self.krb_rc4_hmac elif self.nt_hash is not None: secret = self.nt_hash elif self.krb_aes128 is not None: secret = self.krb_aes128 elif self.krb_aes256 is not None: secret = self.krb_aes256 if secret is None: raise Exception('Couldnt figure out correct stype for customcred!') return MSLDAPCredential(domain=self.domain, username=self.username, password=secret, auth_method=authtype, settings=settings, etypes=None, encrypt=False)
def get_credential(self): """ Creates a credential object :return: Credential object :rtype: :class:`MSLDAPCredential` """ t = MSLDAPCredential(domain=self.domain, username=self.username, password=self.password, auth_method=self.auth_scheme, settings=self.auth_settings) t.encrypt = self.encrypt t.etypes = self.etypes return t
def get_ldap_cred(self, authtype_str: str, target: MSLDAPTarget = None, settings: dict = None, agent_id=None): authtype_str = authtype_str.upper() stype = self.stype.upper() authtype = None if stype == 'SSPIPROXY': if authtype_str == 'NTLM': authtype = LDAPAuthProtocol.SSPIPROXY_NTLM if authtype_str == 'KERBEROS': authtype = LDAPAuthProtocol.SSPIPROXY_KERBEROS else: if authtype_str == 'NTLM': if stype == 'PASSWORD': authtype = LDAPAuthProtocol.NTLM_PASSWORD elif stype in ['RC4', 'NT']: authtype = LDAPAuthProtocol.NTLM_NT elif authtype_str == 'KERBEROS': if stype == 'PASSWORD': authtype = LDAPAuthProtocol.KERBEROS_PASSWORD elif stype in ['RC4', 'NT']: authtype = LDAPAuthProtocol.KERBEROS_RC4 elif stype in ['AES', 'AES128', 'AES256']: authtype = LDAPAuthProtocol.KERBEROS_AES elif authtype_str in ['SSPI', 'SSPI_NTLM']: authtype = LDAPAuthProtocol.SSPI_NTLM elif authtype_str == 'SSPI_KERBEROS': authtype = LDAPAuthProtocol.SSPI_KERBEROS elif authtype_str == 'SSPIPROXY_KERBEROS': authtype = LDAPAuthProtocol.SSPIPROXY_KERBEROS elif authtype_str == 'SSPIPROXY_NTLM': authtype = LDAPAuthProtocol.SSPIPROXY_NTLM if authtype is None: raise Exception('Couldnt find proper LDAP authtype!') return MSLDAPCredential( domain=self.domain, username=self.username, password=self.secret, auth_method=authtype, settings=settings, etypes=None, encrypt=False, )
def get_credential(self): """ Creates a credential object :return: Credential object :rtype: :class:`MSLDAPCredential` """ if self.credential is not None: return copy.deepcopy(self.credential) t = MSLDAPCredential( domain=self.domain, username=self.username, password = self.password, auth_method=self.auth_scheme, settings = self.auth_settings, altname=self.altname, altdomain=self.altdomain ) t.encrypt = self.encrypt t.etypes = self.etypes return t
def get_credential(self): return MSLDAPCredential(domain=self.domain, username=self.username, password=self.password, auth_method=self.auth_scheme, settings=self.auth_settings)