fixup for situations with unexpected LENGTHs in multithreaded mode (e.g. UTF8 data retrieval)

This commit is contained in:
Miroslav Stampar 2010-07-01 14:11:45 +00:00
parent dc8862a140
commit 9d28ae23ca
2 changed files with 17 additions and 1 deletions

View File

@ -973,6 +973,7 @@ def __setKnowledgeBaseAttributes():
logger.debug(debugMsg) logger.debug(debugMsg)
kb.absFilePaths = set() kb.absFilePaths = set()
kb.assumeBlank = False
kb.bannerFp = advancedDict() kb.bannerFp = advancedDict()
kb.cache = advancedDict() kb.cache = advancedDict()

View File

@ -32,6 +32,7 @@ from lib.core.common import dataToStdout
from lib.core.common import getCharset from lib.core.common import getCharset
from lib.core.common import goGoodSamaritan from lib.core.common import goGoodSamaritan
from lib.core.common import getPartRun from lib.core.common import getPartRun
from lib.core.common import readInput
from lib.core.common import replaceNewlineTabs from lib.core.common import replaceNewlineTabs
from lib.core.common import safeStringFormat from lib.core.common import safeStringFormat
from lib.core.convert import urlencode from lib.core.convert import urlencode
@ -289,7 +290,21 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
val = getChar(curidx) val = getChar(curidx)
if val is None: if val is None:
raise sqlmapValueException, "failed to get character at index %d (expected %d total)" % (curidx, length) if not kb.assumeBlank:
iolock.acquire()
warnMsg = "failed to get character at index %d (expected %d total)." % (curidx, length)
logger.warn(warnMsg)
message = "assume blank character? [Y/n/a]"
getOutput = readInput(message, default="Y")
iolock.release()
if getOutput in ("a", "A"):
kb.assumeBlank = True
elif not getOutput or getOutput in ("y", "Y"):
pass # do nothing
else:
raise sqlmapValueException
val = ' '
else: else:
break break