This commit is contained in:
Miroslav Stampar 2015-07-18 17:01:34 +02:00
parent a7c4400cc9
commit 21e8182ac6
6 changed files with 138 additions and 130 deletions

View File

@ -1249,10 +1249,10 @@ def checkNullConnection():
infoMsg = "testing NULL connection to the target URL"
logger.info(infoMsg)
try:
pushValue(kb.pageCompress)
kb.pageCompress = False
try:
page, headers, _ = Request.getPage(method=HTTPMETHOD.HEAD)
if not page and HTTP_HEADER.CONTENT_LENGTH in (headers or {}):
@ -1282,6 +1282,7 @@ def checkNullConnection():
errMsg = getUnicode(errMsg)
raise SqlmapConnectionException(errMsg)
finally:
kb.pageCompress = popValue()
return kb.nullConnection is not None

View File

@ -501,6 +501,7 @@ def start():
kb.testedParams.add(paramKey)
if testSqlInj:
try:
if place == PLACE.COOKIE:
pushValue(kb.mergeCookies)
kb.mergeCookies = False
@ -540,6 +541,7 @@ def start():
warnMsg += "injectable"
logger.warn(warnMsg)
finally:
if place == PLACE.COOKIE:
kb.mergeCookies = popValue()

View File

@ -1030,6 +1030,7 @@ class Connect(object):
if kb.nullConnection and not content and not response and not timeBasedCompare:
noteResponseTime = False
try:
pushValue(kb.pageCompress)
kb.pageCompress = False
@ -1045,7 +1046,7 @@ class Connect(object):
pageLength = int(headers[HTTP_HEADER.CONTENT_LENGTH])
elif kb.nullConnection == NULLCONNECTION.RANGE and HTTP_HEADER.CONTENT_RANGE in headers:
pageLength = int(headers[HTTP_HEADER.CONTENT_RANGE][headers[HTTP_HEADER.CONTENT_RANGE].find('/') + 1:])
finally:
kb.pageCompress = popValue()
if not pageLength:

View File

@ -391,10 +391,12 @@ def getValue(expression, blind=True, union=True, error=True, time=True, fromUser
warnMsg += ". Falling back to partial UNION technique"
singleTimeWarnMessage(warnMsg)
try:
pushValue(kb.forcePartialUnion)
kb.forcePartialUnion = True
value = _goUnion(query, unpack, dump)
found = (value is not None) or (value is None and expectingNone)
finally:
kb.forcePartialUnion = popValue()
else:
singleTimeWarnMessage(warnMsg)

View File

@ -81,6 +81,7 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
return found
try:
pushValue(kb.errorIsNone)
items, ratios = [], []
kb.errorIsNone = False
@ -146,7 +147,7 @@ def _findUnionCharCount(comment, place, parameter, value, prefix, suffix, where=
if max_ > upper:
if retVal is None or abs(max_ - upper) > abs(min_ - lower):
retVal = maxItem[0]
finally:
kb.errorIsNone = popValue()
if retVal:

View File

@ -742,6 +742,7 @@ class Databases:
infoMsg = "enumerating database management system schema"
logger.info(infoMsg)
try:
pushValue(conf.db)
pushValue(conf.tbl)
pushValue(conf.col)
@ -764,7 +765,7 @@ class Databases:
conf.tbl = tbl
self.getColumns()
finally:
conf.col = popValue()
conf.tbl = popValue()
conf.db = popValue()