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

View File

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

View File

@ -1030,6 +1030,7 @@ class Connect(object):
if kb.nullConnection and not content and not response and not timeBasedCompare: if kb.nullConnection and not content and not response and not timeBasedCompare:
noteResponseTime = False noteResponseTime = False
try:
pushValue(kb.pageCompress) pushValue(kb.pageCompress)
kb.pageCompress = False kb.pageCompress = False
@ -1045,7 +1046,7 @@ class Connect(object):
pageLength = int(headers[HTTP_HEADER.CONTENT_LENGTH]) pageLength = int(headers[HTTP_HEADER.CONTENT_LENGTH])
elif kb.nullConnection == NULLCONNECTION.RANGE and HTTP_HEADER.CONTENT_RANGE in headers: 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:]) pageLength = int(headers[HTTP_HEADER.CONTENT_RANGE][headers[HTTP_HEADER.CONTENT_RANGE].find('/') + 1:])
finally:
kb.pageCompress = popValue() kb.pageCompress = popValue()
if not pageLength: 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" warnMsg += ". Falling back to partial UNION technique"
singleTimeWarnMessage(warnMsg) singleTimeWarnMessage(warnMsg)
try:
pushValue(kb.forcePartialUnion) pushValue(kb.forcePartialUnion)
kb.forcePartialUnion = True kb.forcePartialUnion = True
value = _goUnion(query, unpack, dump) value = _goUnion(query, unpack, dump)
found = (value is not None) or (value is None and expectingNone) found = (value is not None) or (value is None and expectingNone)
finally:
kb.forcePartialUnion = popValue() kb.forcePartialUnion = popValue()
else: else:
singleTimeWarnMessage(warnMsg) singleTimeWarnMessage(warnMsg)

View File

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

View File

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