Skip to content

Commit d335ec0

Browse files
committed
turning back on time auto-adjustment mechanism (if turned off) after a threshold run of valid chars
1 parent 00d22f0 commit d335ec0

3 files changed

Lines changed: 14 additions & 1 deletion

File tree

lib/core/option.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1512,6 +1512,7 @@ def __setKnowledgeBaseAttributes(flushAll=True):
15121512
kb.testQueryCount = 0
15131513
kb.threadContinue = True
15141514
kb.threadException = False
1515+
kb.timeValidCharsRun = 0
15151516
kb.uChar = NULL
15161517
kb.xpCmdshellAvailable = False
15171518

lib/core/settings.py

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

488488
# Generic SQL comment formation
489489
GENERIC_SQL_COMMENT = "-- "
490+
491+
# Threshold value for turning back on time auto-adjustment mechanism
492+
VALID_TIME_CHARS_RUN_THRESHOLD = 100

lib/techniques/blind/inference.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
from lib.core.settings import INFERENCE_NOT_EQUALS_CHAR
4444
from lib.core.settings import MAX_TIME_REVALIDATION_STEPS
4545
from lib.core.settings import PARTIAL_VALUE_MARKER
46+
from lib.core.settings import VALID_TIME_CHARS_RUN_THRESHOLD
4647
from lib.core.threads import getCurrentThreadData
4748
from lib.core.threads import runThreads
4849
from lib.core.unescaper import unescaper
@@ -282,13 +283,14 @@ def getChar(idx, charTbl=None, continuousOrder=True, expand=charsetType is None,
282283
errMsg = "invalid character detected. retrying.."
283284
logger.error(errMsg)
284285

286+
kb.timeValidCharsRun = 0
285287
conf.timeSec += 1
286288

287289
warnMsg = "increasing time delay to %d second%s " % (conf.timeSec, 's' if conf.timeSec > 1 else '')
288290
logger.warn(warnMsg)
289291

290292
if kb.adjustTimeDelay:
291-
dbgMsg = "turning off auto-adjustment mechanism"
293+
dbgMsg = "turning off time auto-adjustment mechanism"
292294
logger.debug(dbgMsg)
293295
kb.adjustTimeDelay = False
294296

@@ -299,6 +301,13 @@ def getChar(idx, charTbl=None, continuousOrder=True, expand=charsetType is None,
299301
conf.timeSec = kb.originalTimeDelay
300302
return decodeIntToUnicode(retVal)
301303
else:
304+
if timeBasedCompare:
305+
kb.timeValidCharsRun += 1
306+
if not kb.adjustTimeDelay and kb.timeValidCharsRun > VALID_TIME_CHARS_RUN_THRESHOLD:
307+
dbgMsg = "turning on time auto-adjustment mechanism"
308+
logger.debug(dbgMsg)
309+
kb.adjustTimeDelay = True
310+
302311
return decodeIntToUnicode(retVal)
303312
else:
304313
return None

0 commit comments

Comments
 (0)