|
5 | 5 | See the file 'doc/COPYING' for copying permission |
6 | 6 | """ |
7 | 7 |
|
| 8 | +import re |
8 | 9 | import threading |
9 | 10 | import time |
10 | 11 |
|
|
25 | 26 | from lib.core.common import hashDBRetrieve |
26 | 27 | from lib.core.common import hashDBWrite |
27 | 28 | from lib.core.common import incrementCounter |
| 29 | +from lib.core.common import randomInt |
28 | 30 | from lib.core.common import safeStringFormat |
29 | 31 | from lib.core.common import singleTimeWarnMessage |
30 | 32 | from lib.core.data import conf |
|
42 | 44 | from lib.core.settings import INFERENCE_GREATER_CHAR |
43 | 45 | from lib.core.settings import INFERENCE_EQUALS_CHAR |
44 | 46 | from lib.core.settings import INFERENCE_NOT_EQUALS_CHAR |
| 47 | +from lib.core.settings import MIN_TIME_RESPONSES |
45 | 48 | from lib.core.settings import MAX_BISECTION_LENGTH |
46 | 49 | from lib.core.settings import MAX_TIME_REVALIDATION_STEPS |
47 | 50 | from lib.core.settings import PARTIAL_HEX_VALUE_MARKER |
@@ -267,6 +270,21 @@ def getChar(idx, charTbl=None, continuousOrder=True, expand=charsetType is None, |
267 | 270 | unescapedCharValue = unescaper.escape("'%s'" % decodeIntToUnicode(posValue)) |
268 | 271 | forgedPayload = safeStringFormat(payload, (expressionUnescaped, idx)).replace(markingValue, unescapedCharValue) |
269 | 272 |
|
| 273 | + if timeBasedCompare and kb.whereCollectTimes: |
| 274 | + kb.responseTimes = [] |
| 275 | + |
| 276 | + warnMsg = "\n[%s] [WARNING] time-based comparison requires " % time.strftime("%X") |
| 277 | + warnMsg += "larger statistical model, please wait" |
| 278 | + dataToStdout(warnMsg) |
| 279 | + |
| 280 | + while len(kb.responseTimes) < MIN_TIME_RESPONSES: |
| 281 | + falseWherePayload = re.sub(r"\b%s\b" % posValue, str(randomInt(6)), forgedPayload) |
| 282 | + Request.queryPage(falseWherePayload, content=True, raise404=False) |
| 283 | + dataToStdout('.') |
| 284 | + |
| 285 | + dataToStdout("\n") |
| 286 | + kb.whereCollectTimes = False |
| 287 | + |
270 | 288 | result = Request.queryPage(forgedPayload, timeBasedCompare=timeBasedCompare, raise404=False) |
271 | 289 | incrementCounter(kb.technique) |
272 | 290 |
|
|
0 commit comments