(self, http_obj, method, path, headers)
| 126 | raise Exception('%s auth type not supported' % self.__auth_type) |
| 127 | |
| 128 | def get_auth_headers_basic(self, http_obj, method, path, headers): |
| 129 | if self.__lmhash != '' or self.__nthash != '' or \ |
| 130 | self.__aesKey != '' or self.__TGT != None or self.__TGS != None: |
| 131 | raise Exception('Basic authentication in HTTP connection used, ' |
| 132 | 'so set a plaintext credentials to connect.') |
| 133 | |
| 134 | if self.__domain == '': |
| 135 | auth_line = self.__username + ':' + self.__password |
| 136 | else: |
| 137 | auth_line = self.__domain + '\\' + self.__username + ':' + self.__password |
| 138 | |
| 139 | auth_line_http = 'Basic %s' % base64.b64encode(auth_line.encode('UTF-8')).decode('ascii') |
| 140 | |
| 141 | # Format: auth_headers, reserved, ... |
| 142 | return {'Authorization': auth_line_http}, None |
| 143 | |
| 144 | # It's important that the class contains the separate method that |
| 145 | # gets NTLM Type 1 value, as this way the class can be programmed to |
no test coverage detected