fix for Bug #202

This commit is contained in:
Miroslav Stampar 2010-10-18 08:54:08 +00:00
parent 683184cc8f
commit aaebb4336e
3 changed files with 10 additions and 2 deletions

View File

@ -1031,6 +1031,7 @@ def __setKnowledgeBaseAttributes():
kb.absFilePaths = set() kb.absFilePaths = set()
kb.assumeEmpty = False kb.assumeEmpty = False
kb.authHeader = None
kb.bannerFp = advancedDict() kb.bannerFp = advancedDict()
kb.cache = advancedDict() kb.cache = advancedDict()

View File

@ -286,6 +286,7 @@ def initTargetEnv():
conf.parameters = {} conf.parameters = {}
conf.sessionFile = None conf.sessionFile = None
kb.authHeader = None
kb.dbms = None kb.dbms = None
kb.dbmsDetected = False kb.dbmsDetected = False
kb.dbmsVersion = [ "Unknown" ] kb.dbmsVersion = [ "Unknown" ]

View File

@ -121,6 +121,9 @@ class Connect:
headers["Referer"] = "%s://%s" % (conf.scheme, conf.hostname) headers["Referer"] = "%s://%s" % (conf.scheme, conf.hostname)
if kb.authHeader:
headers["Authorization"] = kb.authHeader
if auxHeaders: if auxHeaders:
for key, item in auxHeaders.items(): for key, item in auxHeaders.items():
headers[key] = item headers[key] = item
@ -163,6 +166,9 @@ class Connect:
conn = urllib2.urlopen(req) conn = urllib2.urlopen(req)
if req.has_header("Authorization"):
kb.authHeader = req.headers["Authorization"]
if hasattr(conn, "redurl") and hasattr(conn, "redcode") and not conf.redirectHandled: if hasattr(conn, "redurl") and hasattr(conn, "redcode") and not conf.redirectHandled:
msg = "sqlmap got a %d redirect to " % conn.redcode msg = "sqlmap got a %d redirect to " % conn.redcode
msg += "%s - What target address do you " % conn.redurl msg += "%s - What target address do you " % conn.redurl