mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-07-01 10:23:41 +03:00
fixing problems with chars deletition by logging messages in inference mode
This commit is contained in:
parent
71028a81f5
commit
e8352e504f
|
@ -83,6 +83,7 @@ from lib.core.settings import DBMS_DICT
|
||||||
from lib.core.settings import DBMS_DIRECTORY_DICT
|
from lib.core.settings import DBMS_DIRECTORY_DICT
|
||||||
from lib.core.settings import DESCRIPTION
|
from lib.core.settings import DESCRIPTION
|
||||||
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
|
from lib.core.settings import DUMMY_SQL_INJECTION_CHARS
|
||||||
|
from lib.core.settings import FORMATTER
|
||||||
from lib.core.settings import NULL
|
from lib.core.settings import NULL
|
||||||
from lib.core.settings import IS_WIN
|
from lib.core.settings import IS_WIN
|
||||||
from lib.core.settings import PLATFORM
|
from lib.core.settings import PLATFORM
|
||||||
|
@ -3166,3 +3167,10 @@ def extractExpectedValue(value, expected):
|
||||||
value = None
|
value = None
|
||||||
|
|
||||||
return value
|
return value
|
||||||
|
|
||||||
|
def setFormatterPrependFlag(value=True):
|
||||||
|
"""
|
||||||
|
Sets logging formatter flag used for signaling if newline is needed before
|
||||||
|
the logging message itself (used in inference mode)
|
||||||
|
"""
|
||||||
|
FORMATTER._prepend_flag = value
|
||||||
|
|
|
@ -81,6 +81,7 @@ from lib.core.settings import DEFAULT_GET_POST_DELIMITER
|
||||||
from lib.core.settings import DEFAULT_PAGE_ENCODING
|
from lib.core.settings import DEFAULT_PAGE_ENCODING
|
||||||
from lib.core.settings import DEFAULT_TOR_HTTP_PORTS
|
from lib.core.settings import DEFAULT_TOR_HTTP_PORTS
|
||||||
from lib.core.settings import DEFAULT_TOR_SOCKS_PORT
|
from lib.core.settings import DEFAULT_TOR_SOCKS_PORT
|
||||||
|
from lib.core.settings import FORMATTER
|
||||||
from lib.core.settings import IS_WIN
|
from lib.core.settings import IS_WIN
|
||||||
from lib.core.settings import NULL
|
from lib.core.settings import NULL
|
||||||
from lib.core.settings import PYVERSION
|
from lib.core.settings import PYVERSION
|
||||||
|
@ -393,6 +394,22 @@ def __setMultipleTargets():
|
||||||
infoMsg += "testable requests from the targets list"
|
infoMsg += "testable requests from the targets list"
|
||||||
logger.info(infoMsg)
|
logger.info(infoMsg)
|
||||||
|
|
||||||
|
def __adjustFormatter():
|
||||||
|
"""
|
||||||
|
Solves problem of line deletition caused by overlapping logging messages
|
||||||
|
and retrieved data info in inference mode
|
||||||
|
"""
|
||||||
|
|
||||||
|
def format(record):
|
||||||
|
_ = FORMATTER._format(record)
|
||||||
|
if FORMATTER._prepend_flag:
|
||||||
|
_ = "\n%s" % _
|
||||||
|
FORMATTER._prepend_flag = False
|
||||||
|
return _
|
||||||
|
FORMATTER._format = FORMATTER.format
|
||||||
|
FORMATTER._prepend_flag = False
|
||||||
|
FORMATTER.format = format
|
||||||
|
|
||||||
def __setRequestFromFile():
|
def __setRequestFromFile():
|
||||||
"""
|
"""
|
||||||
This function checks if the way to make a HTTP request is through supplied
|
This function checks if the way to make a HTTP request is through supplied
|
||||||
|
@ -1885,6 +1902,7 @@ def init(inputOptions=AttribDict(), overrideOptions=False):
|
||||||
__checkDependencies()
|
__checkDependencies()
|
||||||
__basicOptionValidation()
|
__basicOptionValidation()
|
||||||
__setTorProxySettings()
|
__setTorProxySettings()
|
||||||
|
__adjustFormatter()
|
||||||
__setMultipleTargets()
|
__setMultipleTargets()
|
||||||
__setTamperingFunctions()
|
__setTamperingFunctions()
|
||||||
__setTrafficOutputFP()
|
__setTrafficOutputFP()
|
||||||
|
|
|
@ -23,6 +23,7 @@ from lib.core.common import goGoodSamaritan
|
||||||
from lib.core.common import getPartRun
|
from lib.core.common import getPartRun
|
||||||
from lib.core.common import incrementCounter
|
from lib.core.common import incrementCounter
|
||||||
from lib.core.common import safeStringFormat
|
from lib.core.common import safeStringFormat
|
||||||
|
from lib.core.common import setFormatterPrependFlag
|
||||||
from lib.core.common import singleTimeWarnMessage
|
from lib.core.common import singleTimeWarnMessage
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import kb
|
from lib.core.data import kb
|
||||||
|
@ -449,6 +450,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
etaProgressUpdate(time.time() - charStart, len(commonValue))
|
etaProgressUpdate(time.time() - charStart, len(commonValue))
|
||||||
elif conf.verbose in (1, 2):
|
elif conf.verbose in (1, 2):
|
||||||
dataToStdout(commonValue[index-1:])
|
dataToStdout(commonValue[index-1:])
|
||||||
|
setFormatterPrependFlag(True)
|
||||||
|
|
||||||
finalValue = commonValue
|
finalValue = commonValue
|
||||||
|
|
||||||
|
@ -497,6 +499,7 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
etaProgressUpdate(time.time() - charStart, index)
|
etaProgressUpdate(time.time() - charStart, index)
|
||||||
elif conf.verbose in (1, 2):
|
elif conf.verbose in (1, 2):
|
||||||
dataToStdout(val)
|
dataToStdout(val)
|
||||||
|
setFormatterPrependFlag(True)
|
||||||
|
|
||||||
if len(partialValue) > INFERENCE_BLANK_BREAK and partialValue[-INFERENCE_BLANK_BREAK:].isspace():
|
if len(partialValue) > INFERENCE_BLANK_BREAK and partialValue[-INFERENCE_BLANK_BREAK:].isspace():
|
||||||
finalValue = partialValue
|
finalValue = partialValue
|
||||||
|
@ -504,6 +507,8 @@ def bisection(payload, expression, length=None, charsetType=None, firstChar=None
|
||||||
|
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
abortedFlag = True
|
abortedFlag = True
|
||||||
|
finally:
|
||||||
|
setFormatterPrependFlag(False)
|
||||||
|
|
||||||
if conf.verbose in (1, 2) or showEta:
|
if conf.verbose in (1, 2) or showEta:
|
||||||
dataToStdout("\n")
|
dataToStdout("\n")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user