@@ -1310,7 +1310,7 @@ def _setAuthCred():
13101310
13111311def _setHTTPAuthentication ():
13121312 """
1313- Check and set the HTTP(s) authentication method (Basic, Digest, NTLM or PKI),
1313+ Check and set the HTTP(s) authentication method (Basic, Digest, Bearer, NTLM or PKI),
13141314 username and password for first three methods, or PEM private key file for
13151315 PKI authentication
13161316 """
@@ -1333,9 +1333,9 @@ def _setHTTPAuthentication():
13331333 errMsg += "but did not provide the type (e.g. --auth-type=\" basic\" )"
13341334 raise SqlmapSyntaxException (errMsg )
13351335
1336- elif (conf .authType or "" ).lower () not in (AUTH_TYPE .BASIC , AUTH_TYPE .DIGEST , AUTH_TYPE .NTLM , AUTH_TYPE .PKI ):
1336+ elif (conf .authType or "" ).lower () not in (AUTH_TYPE .BASIC , AUTH_TYPE .DIGEST , AUTH_TYPE .BEARER , AUTH_TYPE . NTLM , AUTH_TYPE .PKI ):
13371337 errMsg = "HTTP authentication type value must be "
1338- errMsg += "Basic, Digest, NTLM or PKI"
1338+ errMsg += "Basic, Digest, Bearer, NTLM or PKI"
13391339 raise SqlmapSyntaxException (errMsg )
13401340
13411341 if not conf .authFile :
@@ -1348,6 +1348,9 @@ def _setHTTPAuthentication():
13481348 regExp = "^(.*?):(.*?)$"
13491349 errMsg = "HTTP %s authentication credentials " % authType
13501350 errMsg += "value must be in format 'username:password'"
1351+ elif authType == AUTH_TYPE .BEARER :
1352+ conf .httpHeaders .append ((HTTP_HEADER .AUTHORIZATION , "Bearer %s" % conf .authCred .strip ()))
1353+ return
13511354 elif authType == AUTH_TYPE .NTLM :
13521355 regExp = "^(.*\\ \\ .*):(.*?)$"
13531356 errMsg = "HTTP NTLM authentication credentials value must "
0 commit comments