Cleaning up cases with Set-Cookie (conf.cj is handling it automatically; also, default redirector needed to be patched)

This commit is contained in:
stamparm 2013-02-28 13:51:08 +01:00
parent aa59266804
commit 9ef79df23d
3 changed files with 3 additions and 10 deletions

View File

@ -1620,7 +1620,6 @@ def _setKnowledgeBaseAttributes(flushAll=True):
kb.proxyAuthHeader = None
kb.queryCounter = 0
kb.redirectChoice = None
kb.redirectSetCookie = None
kb.reflectiveMechanism = True
kb.reflectiveCounters = {REFLECTIVE_COUNTER.MISS: 0, REFLECTIVE_COUNTER.HIT: 0}
kb.requestCounter = 0

View File

@ -82,12 +82,6 @@ def forgeHeaders(items=None):
if kb.testMode:
resetCookieJar(conf.cj)
if kb.redirectSetCookie and not conf.dropSetCookie:
if HTTPHEADER.COOKIE in headers:
headers[HTTPHEADER.COOKIE] += "%s %s" % (DEFAULT_COOKIE_DELIMITER, kb.redirectSetCookie)
else:
headers[HTTPHEADER.COOKIE] = kb.redirectSetCookie
return headers
def parseResponse(page, headers):

View File

@ -19,6 +19,7 @@ from lib.core.enums import HTTPHEADER
from lib.core.enums import HTTPMETHOD
from lib.core.enums import REDIRECTION
from lib.core.exception import SqlmapConnectionException
from lib.core.settings import DEFAULT_COOKIE_DELIMITER
from lib.core.settings import MAX_CONNECTION_CHUNK_SIZE
from lib.core.settings import MAX_CONNECTION_TOTAL_SIZE
from lib.core.settings import MAX_SINGLE_URL_REDIRECTIONS
@ -110,13 +111,12 @@ class SmartRedirectHandler(urllib2.HTTPRedirectHandler):
if redurl and kb.redirectChoice == REDIRECTION.YES:
req.headers[HTTPHEADER.HOST] = getHostHeader(redurl)
if headers and HTTPHEADER.SET_COOKIE in headers:
req.headers[HTTPHEADER.COOKIE] = headers[HTTPHEADER.SET_COOKIE].split(DEFAULT_COOKIE_DELIMITER)[0]
result = urllib2.HTTPRedirectHandler.http_error_302(self, req, fp, code, msg, headers)
else:
result = fp
if HTTPHEADER.SET_COOKIE in headers:
kb.redirectSetCookie = headers.get(HTTPHEADER.SET_COOKIE).split("; path")[0]
result.redcode = code
result.redurl = redurl