(self, http_obj, method, path, headers)
| 184 | return serverChallenge, None |
| 185 | |
| 186 | def get_auth_headers_auto(self, http_obj, method, path, headers): |
| 187 | if self.__aesKey != '' or self.__TGT != None or self.__TGS != None: |
| 188 | raise Exception('NTLM authentication in HTTP connection used, ' \ |
| 189 | 'cannot use Kerberos.') |
| 190 | |
| 191 | auth = ntlm.getNTLMSSPType1(domain=self.__domain) |
| 192 | serverChallenge = self.send_ntlm_type1(http_obj, method, path, headers, auth.getData())[0] |
| 193 | |
| 194 | if serverChallenge is not None: |
| 195 | self.__auth_type = AUTH_NTLM |
| 196 | |
| 197 | type3, exportedSessionKey = ntlm.getNTLMSSPType3(auth, serverChallenge, self.__username, |
| 198 | self.__password, self.__domain, |
| 199 | self.__lmhash, self.__nthash) |
| 200 | |
| 201 | auth_line_http = 'NTLM %s' % base64.b64encode(type3.getData()).decode('ascii') |
| 202 | else: |
| 203 | if self.__auth_type == AUTH_AUTO and AUTH_BASIC in self.__auth_types: |
| 204 | self.__auth_type = AUTH_BASIC |
| 205 | return self.get_auth_headers_basic(http_obj, method, path, headers) |
| 206 | else: |
| 207 | raise Exception('No supported auth offered by URL: %s' % self.__auth_types) |
| 208 | |
| 209 | # Format: auth_headers, reserved, ... |
| 210 | return {'Authorization': auth_line_http}, None |
no test coverage detected