mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-29 13:03:50 +03:00
Fix for issue Issue #60
This commit is contained in:
parent
76f7f907c6
commit
438a636973
|
@ -3147,7 +3147,7 @@ def hashDBRetrieve(key, unserialize=False, checkConf=False):
|
||||||
|
|
||||||
_ = "%s%s%s" % (conf.url or "%s%s" % (conf.hostname, conf.port), key, HASHDB_MILESTONE_VALUE)
|
_ = "%s%s%s" % (conf.url or "%s%s" % (conf.hostname, conf.port), key, HASHDB_MILESTONE_VALUE)
|
||||||
_ = conf.hashDB.retrieve(_, unserialize) if kb.resumeValues and not (checkConf and any([conf.flushSession, conf.freshQueries])) else None
|
_ = conf.hashDB.retrieve(_, unserialize) if kb.resumeValues and not (checkConf and any([conf.flushSession, conf.freshQueries])) else None
|
||||||
if not kb.inferenceMode and _ and PARTIAL_VALUE_MARKER in _:
|
if not kb.inferenceMode and not kb.fileReadMode and _ and PARTIAL_VALUE_MARKER in _:
|
||||||
_ = None
|
_ = None
|
||||||
return _
|
return _
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@ from lib.core.enums import PAYLOAD
|
||||||
from lib.core.settings import FROM_DUMMY_TABLE
|
from lib.core.settings import FROM_DUMMY_TABLE
|
||||||
from lib.core.settings import MYSQL_ERROR_CHUNK_LENGTH
|
from lib.core.settings import MYSQL_ERROR_CHUNK_LENGTH
|
||||||
from lib.core.settings import MSSQL_ERROR_CHUNK_LENGTH
|
from lib.core.settings import MSSQL_ERROR_CHUNK_LENGTH
|
||||||
|
from lib.core.settings import PARTIAL_VALUE_MARKER
|
||||||
from lib.core.settings import SLOW_ORDER_COUNT_THRESHOLD
|
from lib.core.settings import SLOW_ORDER_COUNT_THRESHOLD
|
||||||
from lib.core.settings import SQL_SCALAR_REGEX
|
from lib.core.settings import SQL_SCALAR_REGEX
|
||||||
from lib.core.settings import TURN_OFF_RESUME_INFO_LIMIT
|
from lib.core.settings import TURN_OFF_RESUME_INFO_LIMIT
|
||||||
|
@ -44,15 +45,21 @@ from lib.core.unescaper import unescaper
|
||||||
from lib.request.connect import Connect as Request
|
from lib.request.connect import Connect as Request
|
||||||
|
|
||||||
def __oneShotErrorUse(expression, field):
|
def __oneShotErrorUse(expression, field):
|
||||||
|
offset = 1
|
||||||
|
partialValue = None
|
||||||
|
threadData = getCurrentThreadData()
|
||||||
retVal = hashDBRetrieve(expression, checkConf=True)
|
retVal = hashDBRetrieve(expression, checkConf=True)
|
||||||
|
|
||||||
threadData = getCurrentThreadData()
|
if retVal and PARTIAL_VALUE_MARKER in retVal:
|
||||||
threadData.resumed = retVal is not None
|
partialValue = retVal = retVal.replace(PARTIAL_VALUE_MARKER, "")
|
||||||
|
dataToStdout("[%s] [INFO] resuming partial value: '%s'\r\n" % (time.strftime("%X"), __formatPartialContent(partialValue)))
|
||||||
|
offset += len(partialValue)
|
||||||
|
|
||||||
offset = 1
|
threadData.resumed = retVal is not None and not partialValue
|
||||||
chunk_length = None
|
chunk_length = None
|
||||||
|
|
||||||
if retVal is None:
|
if retVal is None or partialValue:
|
||||||
|
try:
|
||||||
while True:
|
while True:
|
||||||
check = "%s(?P<result>.*?)%s" % (kb.chars.start, kb.chars.stop)
|
check = "%s(?P<result>.*?)%s" % (kb.chars.start, kb.chars.stop)
|
||||||
trimcheck = "%s(?P<result>.*?)</" % (kb.chars.start)
|
trimcheck = "%s(?P<result>.*?)</" % (kb.chars.start)
|
||||||
|
@ -118,16 +125,13 @@ def __oneShotErrorUse(expression, field):
|
||||||
break
|
break
|
||||||
|
|
||||||
if kb.fileReadMode and output:
|
if kb.fileReadMode and output:
|
||||||
_ = output
|
dataToStdout(__formatPartialContent(output).replace(r"\n", "\n"))
|
||||||
try:
|
|
||||||
_ = safecharencode(output.decode("hex")).replace(r"\n", "\n")
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
finally:
|
|
||||||
dataToStdout(_)
|
|
||||||
else:
|
else:
|
||||||
retVal = output
|
retVal = output
|
||||||
break
|
break
|
||||||
|
except:
|
||||||
|
hashDBWrite(expression, "%s%s" % (retVal, PARTIAL_VALUE_MARKER))
|
||||||
|
raise
|
||||||
|
|
||||||
retVal = decodeHexValue(retVal) if conf.hexConvert else retVal
|
retVal = decodeHexValue(retVal) if conf.hexConvert else retVal
|
||||||
|
|
||||||
|
@ -194,6 +198,20 @@ def __errorReplaceChars(value):
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
|
def __formatPartialContent(value):
|
||||||
|
"""
|
||||||
|
Prepares (possibly hex) partial content for safe console output
|
||||||
|
"""
|
||||||
|
|
||||||
|
if value and isinstance(value, basestring):
|
||||||
|
try:
|
||||||
|
value = value.decode("hex")
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
finally:
|
||||||
|
value = safecharencode(value)
|
||||||
|
return value
|
||||||
|
|
||||||
def errorUse(expression, expected=None, dump=False):
|
def errorUse(expression, expected=None, dump=False):
|
||||||
"""
|
"""
|
||||||
Retrieve the output of a SQL query taking advantage of the error-based
|
Retrieve the output of a SQL query taking advantage of the error-based
|
||||||
|
|
Loading…
Reference in New Issue
Block a user