mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-12-09 14:11:29 +00:00
Implements #2908
This commit is contained in:
@@ -43,6 +43,7 @@ from lib.core.dicts import FROM_DUMMY_TABLE
|
||||
from lib.core.enums import DBMS
|
||||
from lib.core.enums import HASHDB_KEYS
|
||||
from lib.core.enums import HTTP_HEADER
|
||||
from lib.core.enums import PAYLOAD
|
||||
from lib.core.exception import SqlmapDataException
|
||||
from lib.core.settings import CHECK_ZERO_COLUMNS_THRESHOLD
|
||||
from lib.core.settings import MAX_ERROR_CHUNK_LENGTH
|
||||
@@ -123,7 +124,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||
nulledCastedField = queries[Backend.getIdentifiedDbms()].substring.query % (nulledCastedField, offset, kb.errorChunkLength)
|
||||
|
||||
# Forge the error-based SQL injection request
|
||||
vector = kb.injection.data[kb.technique].vector
|
||||
vector = kb.injection.data[PAYLOAD.TECHNIQUE.ERROR].vector
|
||||
query = agent.prefixQuery(vector)
|
||||
query = agent.suffixQuery(query)
|
||||
injExpression = expression.replace(field, nulledCastedField, 1) if field else expression
|
||||
@@ -134,7 +135,7 @@ def _oneShotErrorUse(expression, field=None, chunkTest=False):
|
||||
# Perform the request
|
||||
page, headers, _ = Request.queryPage(payload, content=True, raise404=False)
|
||||
|
||||
incrementCounter(kb.technique)
|
||||
incrementCounter(PAYLOAD.TECHNIQUE.ERROR)
|
||||
|
||||
if page and conf.noEscape:
|
||||
page = re.sub(r"('|\%%27)%s('|\%%27).*?('|\%%27)%s('|\%%27)" % (kb.chars.start, kb.chars.stop), "", page)
|
||||
@@ -247,7 +248,7 @@ def _errorFields(expression, expressionFields, expressionFieldsList, num=None, e
|
||||
if not kb.threadContinue:
|
||||
return None
|
||||
|
||||
if not suppressOutput:
|
||||
if not any((suppressOutput, kb.bruteMode)):
|
||||
if kb.fileReadMode and output and output.strip():
|
||||
print()
|
||||
elif output is not None and not (threadData.resumed and kb.suppressResumeInfo) and not (emptyFields and field in emptyFields):
|
||||
@@ -298,7 +299,7 @@ def errorUse(expression, dump=False):
|
||||
SQL injection vulnerability on the affected parameter.
|
||||
"""
|
||||
|
||||
initTechnique(kb.technique)
|
||||
initTechnique(PAYLOAD.TECHNIQUE.ERROR)
|
||||
|
||||
abortedFlag = False
|
||||
count = None
|
||||
@@ -460,7 +461,7 @@ def errorUse(expression, dump=False):
|
||||
duration = calculateDeltaSeconds(start)
|
||||
|
||||
if not kb.bruteMode:
|
||||
debugMsg = "performed %d queries in %.2f seconds" % (kb.counters[kb.technique], duration)
|
||||
debugMsg = "performed %d queries in %.2f seconds" % (kb.counters[PAYLOAD.TECHNIQUE.ERROR], duration)
|
||||
logger.debug(debugMsg)
|
||||
|
||||
return value
|
||||
|
||||
@@ -312,6 +312,7 @@ def _unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix)
|
||||
|
||||
return validPayload, vector
|
||||
|
||||
@stackedmethod
|
||||
def unionTest(comment, place, parameter, value, prefix, suffix):
|
||||
"""
|
||||
This method tests if the target URL is affected by an union
|
||||
|
||||
@@ -376,7 +376,7 @@ def unionUse(expression, unpack=True, dump=False):
|
||||
threadData.shared.value.extend(arrayizeValue(_))
|
||||
del threadData.shared.buffered[0]
|
||||
|
||||
if conf.verbose == 1 and not (threadData.resumed and kb.suppressResumeInfo) and not threadData.shared.showEta:
|
||||
if conf.verbose == 1 and not (threadData.resumed and kb.suppressResumeInfo) and not threadData.shared.showEta and not kb.bruteMode:
|
||||
_ = ','.join("'%s'" % _ for _ in (flattenValue(arrayizeValue(items)) if not isinstance(items, six.string_types) else [items]))
|
||||
status = "[%s] [INFO] %s: %s" % (time.strftime("%X"), "resumed" if threadData.resumed else "retrieved", _ if kb.safeCharEncode else safecharencode(_))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user