Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion stetl/inputs/httpinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ def add_authorization(self, request):
# Basic auth: http://mozgovipc.blogspot.nl/2012/06/python-http-basic-authentication-with.html
# base64 encode username and password
# write the Authorization header like: 'Basic base64encode(username + ':' + password)
auth_val = base64.encodestring('%s:%s' % (auth_creds['user'], auth_creds['password']))
creds = '%s:%s' % (auth_creds['user'], auth_creds['password'])
auth_val = base64.b64encode(creds.encode('utf-8')).decode('utf-8')
auth_val = "Basic %s" % auth_val
elif auth_type == 'token':
# Bearer Type, see eg. https://tools.ietf.org/html/rfc6750
Expand Down
5 changes: 3 additions & 2 deletions stetl/outputs/httpoutput.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,9 @@ def post(self, packet, payload):
# basic auth: http://mozgovipc.blogspot.nl/2012/06/python-http-basic-authentication-with.html
# base64 encode the username and password
# write the Authorization header like: 'Basic base64encode(username + ':' + password)
if self.user is not None:
auth = base64.encodestring('%s:%s' % (self.user, self.password)).replace('\n', '')
if self.user is not None and self.password is not None:
creds = '%s:%s' % (self.user, self.password)
auth = base64.b64encode(creds.encode('utf-8')).decode('utf-8')
webservice.putheader("Authorization", "Basic %s" % auth)

webservice.endheaders()
Expand Down