Skip to content

Commit 1e092c4

Browse files
committed
Just in case update for an Issue sqlmapproject#2474
1 parent 1e31063 commit 1e092c4

File tree

3 files changed

+28
-7
lines changed

3 files changed

+28
-7
lines changed

lib/core/common.py

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
import subprocess
2727
import sys
2828
import tempfile
29+
import threading
2930
import time
3031
import urllib
3132
import urllib2
@@ -139,6 +140,7 @@
139140
from lib.core.settings import REFLECTED_BORDER_REGEX
140141
from lib.core.settings import REFLECTED_MAX_REGEX_PARTS
141142
from lib.core.settings import REFLECTED_REPLACEMENT_REGEX
143+
from lib.core.settings import REFLECTED_REPLACEMENT_TIMEOUT
142144
from lib.core.settings import REFLECTED_VALUE_MARKER
143145
from lib.core.settings import REFLECTIVE_MISS_THRESHOLD
144146
from lib.core.settings import SENSITIVE_DATA_REGEX
@@ -3429,11 +3431,27 @@ def _(value):
34293431
else:
34303432
regex = r"%s\b" % regex
34313433

3432-
retVal = re.sub(r"(?i)%s" % regex, REFLECTED_VALUE_MARKER, retVal)
3434+
_retVal = [retVal]
3435+
def _thread(regex):
3436+
_retVal[0] = re.sub(r"(?i)%s" % regex, REFLECTED_VALUE_MARKER, _retVal[0])
34333437

3434-
if len(parts) > 2:
3435-
regex = REFLECTED_REPLACEMENT_REGEX.join(parts[1:])
3436-
retVal = re.sub(r"(?i)\b%s\b" % regex, REFLECTED_VALUE_MARKER, retVal)
3438+
if len(parts) > 2:
3439+
regex = REFLECTED_REPLACEMENT_REGEX.join(parts[1:])
3440+
_retVal[0] = re.sub(r"(?i)\b%s\b" % regex, REFLECTED_VALUE_MARKER, _retVal[0])
3441+
3442+
thread = threading.Thread(target=_thread, args=(regex,))
3443+
thread.daemon = True
3444+
thread.start()
3445+
thread.join(REFLECTED_REPLACEMENT_TIMEOUT)
3446+
3447+
if thread.isAlive():
3448+
kb.reflectiveMechanism = False
3449+
retVal = content
3450+
if not suppressWarning:
3451+
debugMsg = "turning off reflection removal mechanism (because of timeouts)"
3452+
logger.debug(debugMsg)
3453+
else:
3454+
retVal = _retVal[0]
34373455

34383456
if retVal != content:
34393457
kb.reflectiveCounters[REFLECTIVE_COUNTER.HIT] += 1

lib/core/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.enums import OS
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.1.4.16"
22+
VERSION = "1.1.4.18"
2323
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
2424
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
2525
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@@ -386,6 +386,9 @@
386386
# Regular expression used for replacing non-alphanum characters
387387
REFLECTED_REPLACEMENT_REGEX = r".+"
388388

389+
# Maximum time (in seconds) spent per reflective value(s) replacement
390+
REFLECTED_REPLACEMENT_TIMEOUT = 3
391+
389392
# Maximum number of alpha-numerical parts in reflected regex (for speed purposes)
390393
REFLECTED_MAX_REGEX_PARTS = 10
391394

txt/checksum.md5

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ d79481ab99acd739615e747d4a79d9d0 lib/controller/handler.py
2626
310efc965c862cfbd7b0da5150a5ad36 lib/controller/__init__.py
2727
19905ecb4437b94512cf21d5f1720091 lib/core/agent.py
2828
6cc95a117fbd34ef31b9aa25520f0e31 lib/core/bigarray.py
29-
f667d34b2869016ac2b97f82c4463599 lib/core/common.py
29+
8f827c514751b85890da09581c21285c lib/core/common.py
3030
5065a4242a8cccf72f91e22e1007ae63 lib/core/convert.py
3131
a8143dab9d3a27490f7d49b6b29ea530 lib/core/data.py
3232
7936d78b1a7f1f008ff92bf2f88574ba lib/core/datatype.py
@@ -45,7 +45,7 @@ dd19b4d930d418f8aef498941346ab2d lib/core/option.py
4545
d8e9250f3775119df07e9070eddccd16 lib/core/replication.py
4646
785f86e3f963fa3798f84286a4e83ff2 lib/core/revision.py
4747
40c80b28b3a5819b737a5a17d4565ae9 lib/core/session.py
48-
f2cace15ba198ea85d8d67981ee739ea lib/core/settings.py
48+
78ce748dd65ba204321cb74c53ec55e3 lib/core/settings.py
4949
d91291997d2bd2f6028aaf371bf1d3b6 lib/core/shell.py
5050
2ad85c130cc5f2b3701ea85c2f6bbf20 lib/core/subprocessng.py
5151
afd0636d2e93c23f4f0a5c9b6023ea17 lib/core/target.py

0 commit comments

Comments
 (0)