mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-05-09 18:23:45 +03:00
adding filtering of strings for control chars in blind inference mode (way to handle either errornous values, or either binary data)
This commit is contained in:
parent
c83e9f6ca5
commit
7ae5192070
|
@ -61,6 +61,7 @@ from lib.core.settings import IS_WIN
|
||||||
from lib.core.settings import PLATFORM
|
from lib.core.settings import PLATFORM
|
||||||
from lib.core.settings import SITE
|
from lib.core.settings import SITE
|
||||||
from lib.core.settings import ERROR_PARSING_REGEXES
|
from lib.core.settings import ERROR_PARSING_REGEXES
|
||||||
|
from lib.core.settings import NON_CONTROL_CHAR_REGEX
|
||||||
from lib.core.settings import SQL_STATEMENTS
|
from lib.core.settings import SQL_STATEMENTS
|
||||||
from lib.core.settings import SUPPORTED_DBMS
|
from lib.core.settings import SUPPORTED_DBMS
|
||||||
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
from lib.core.settings import UNKNOWN_DBMS_VERSION
|
||||||
|
@ -1823,6 +1824,13 @@ def filterStringValue(value, regex, replace=None):
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
||||||
|
def filterControlChars(value):
|
||||||
|
"""
|
||||||
|
Returns string value with control
|
||||||
|
chars being supstituted with ' '
|
||||||
|
"""
|
||||||
|
return filterStringValue(output, NON_CONTROL_CHAR_REGEX, ' ')
|
||||||
|
|
||||||
def isDBMSVersionAtLeast(version):
|
def isDBMSVersionAtLeast(version):
|
||||||
"""
|
"""
|
||||||
Checks if the recognized DBMS version
|
Checks if the recognized DBMS version
|
||||||
|
|
|
@ -52,7 +52,7 @@ DUMP_STOP_MARKER = "__STOP__"
|
||||||
|
|
||||||
PAYLOAD_DELIMITER = "\x00"
|
PAYLOAD_DELIMITER = "\x00"
|
||||||
CHAR_INFERENCE_MARK = "%c"
|
CHAR_INFERENCE_MARK = "%c"
|
||||||
READABLE_CHAR_REGEX = r'[\ -~]'
|
NON_CONTROL_CHAR_REGEX = r'[^\x00-\x1f]'
|
||||||
|
|
||||||
# coefficient used for a time-based query delay checking (must be >= 7)
|
# coefficient used for a time-based query delay checking (must be >= 7)
|
||||||
TIME_STDEV_COEFF = 10
|
TIME_STDEV_COEFF = 10
|
||||||
|
|
|
@ -14,6 +14,7 @@ import traceback
|
||||||
from lib.core.agent import agent
|
from lib.core.agent import agent
|
||||||
from lib.core.common import dataToSessionFile
|
from lib.core.common import dataToSessionFile
|
||||||
from lib.core.common import dataToStdout
|
from lib.core.common import dataToStdout
|
||||||
|
from lib.core.common import filterControlChars
|
||||||
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
|
||||||
|
@ -324,7 +325,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
output += status if count != length else " "*len(status)
|
output += status if count != length else " "*len(status)
|
||||||
|
|
||||||
iolock.acquire()
|
iolock.acquire()
|
||||||
dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), replaceNewlineTabs(output, stdout=True)))
|
dataToStdout("\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(output)))
|
||||||
iolock.release()
|
iolock.release()
|
||||||
|
|
||||||
if not kb.threadContinue:
|
if not kb.threadContinue:
|
||||||
|
@ -394,10 +395,10 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
|
|
||||||
if partialValue:
|
if partialValue:
|
||||||
finalValue = partialValue
|
finalValue = partialValue
|
||||||
infoMsg = "\r[%s] [INFO] partially retrieved: %s" % (time.strftime("%X"), finalValue)
|
infoMsg = "\r[%s] [INFO] partially retrieved: %s" % (time.strftime("%X"), filterControlChars(finalValue))
|
||||||
else:
|
else:
|
||||||
finalValue = "".join(value)
|
finalValue = "".join(value)
|
||||||
infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), finalValue)
|
infoMsg = "\r[%s] [INFO] retrieved: %s" % (time.strftime("%X"), filterControlChars(finalValue))
|
||||||
|
|
||||||
if isinstance(finalValue, basestring) and len(finalValue) > 0:
|
if isinstance(finalValue, basestring) and len(finalValue) > 0:
|
||||||
dataToSessionFile(replaceNewlineTabs(finalValue))
|
dataToSessionFile(replaceNewlineTabs(finalValue))
|
||||||
|
@ -499,7 +500,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
dataToStdout("\n")
|
dataToStdout("\n")
|
||||||
|
|
||||||
if ( conf.verbose in ( 1, 2 ) and showEta ) or conf.verbose >= 3:
|
if ( conf.verbose in ( 1, 2 ) and showEta ) or conf.verbose >= 3:
|
||||||
infoMsg = "retrieved: %s" % finalValue
|
infoMsg = "retrieved: %s" % filterControlChars(finalValue)
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
if not partialValue:
|
if not partialValue:
|
||||||
|
|
Loading…
Reference in New Issue
Block a user