MCPcopy Create free account
hub / github.com/fortra/impacket / get_auth_headers_basic

Method get_auth_headers_basic

impacket/http.py:128–142  ·  view source on GitHub ↗
(self, http_obj, method, path, headers)

Source from the content-addressed store, hash-verified

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

Callers 2

get_auth_headersMethod · 0.95
get_auth_headers_autoMethod · 0.95

Calls 2

encodeMethod · 0.80
decodeMethod · 0.45

Tested by

no test coverage detected