Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit abb4018

Browse files
committed
minor update
1 parent 087e29d commit abb4018

2 files changed

Lines changed: 15 additions & 3 deletions

File tree

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,3 +428,6 @@
428428

429429
# Warn user of possible delay due to large page dump in full UNION query injections
430430
LARGE_OUTPUT_THRESHOLD = 1024**2
431+
432+
# On huge tables there is a considerable slowdown if every row retrieval requires ORDER BY (most noticable in table dumping using ERROR injections)
433+
SLOW_ORDER_COUNT_THRESHOLD = 10000

lib/techniques/error/use.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from lib.core.common import isNumPosStrValue
2525
from lib.core.common import listToStrValue
2626
from lib.core.common import randomInt
27+
from lib.core.common import readInput
2728
from lib.core.common import safeStringFormat
2829
from lib.core.convert import htmlunescape
2930
from lib.core.convert import safecharencode
@@ -38,6 +39,7 @@
3839
from lib.core.settings import FROM_TABLE
3940
from lib.core.settings import MYSQL_ERROR_CHUNK_LENGTH
4041
from lib.core.settings import MSSQL_ERROR_CHUNK_LENGTH
42+
from lib.core.settings import SLOW_ORDER_COUNT_THRESHOLD
4143
from lib.core.settings import SQL_SCALAR_REGEX
4244
from lib.core.settings import TURN_OFF_RESUME_INFO_LIMIT
4345
from lib.core.threads import getCurrentThreadData
@@ -292,9 +294,8 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False):
292294
# Count the number of SQL query entries output
293295
countedExpression = expression.replace(expressionFields, queries[Backend.getIdentifiedDbms()].count.query % '*', 1)
294296

295-
if re.search(" ORDER BY ", expression, re.I):
296-
untilOrderChar = countedExpression.index(" ORDER BY ")
297-
countedExpression = countedExpression[:untilOrderChar]
297+
if " ORDER BY " in expression:
298+
countedExpression = countedExpression[:countedExpression.index(" ORDER BY ")]
298299

299300
count = resume(countedExpression, None)
300301

@@ -328,6 +329,14 @@ def errorUse(expression, expected=None, resumeValue=True, dump=False):
328329

329330
return outputs
330331

332+
if " ORDER BY " in expression and (stopLimit - startLimit) > SLOW_ORDER_COUNT_THRESHOLD:
333+
message = "due to huge table size do you want to remove "
334+
message += "ORDER BY clause gaining speed over consistency? [y/N] "
335+
output = readInput(message, default="N")
336+
337+
if output and output[0] in ("y", "Y"):
338+
expression = expression[:expression.index(" ORDER BY ")]
339+
331340
threadData = getCurrentThreadData()
332341
threadData.shared.limits = iter(xrange(startLimit, stopLimit))
333342
numThreads = min(conf.threads, (stopLimit - startLimit))

0 commit comments

Comments
 (0)