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

Skip to content

Commit cd6e2f1

Browse files
committed
Minor optimization of randomizeParameterValue
1 parent fbee649 commit cd6e2f1

3 files changed

Lines changed: 22 additions & 24 deletions

File tree

data/txt/sha256sums.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ e376093d4f6e42ee38b050af329179df9c1c136b7667b2f1cb559f5d4b69ebd9 lib/controller
167167
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/controller/__init__.py
168168
2a96190ced25d8929861b13866101812fcadf5cac23dd1dd4b29b1a915918769 lib/core/agent.py
169169
b13462712ec5ac07541dba98631ddcda279d210b838f363d15ac97a1413b67a2 lib/core/bigarray.py
170-
28c5189446a642c8ee0a887b150b96ca9a05ad32e57240e1e5195e8217dfa388 lib/core/common.py
170+
f7ae9ac5ab4abb7e0a485a7fdebcf3588b64e8f0662e14b569015429535e3116 lib/core/common.py
171171
a6397b10de7ae7c56ed6b0fa3b3c58eb7a9dbede61bf93d786e73258175c981e lib/core/compat.py
172172
a9997e97ebe88e0bf7efcf21e878bc5f62c72348e5aba18f64d6861390a4dcf2 lib/core/convert.py
173173
c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data.py
@@ -188,7 +188,7 @@ a033f92d136c707a25927c2383125ddb004d4283db62c004dcd67c3fc242bb1c lib/core/dump.
188188
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
189189
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
190190
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
191-
94f6f12a431c34d4cfa821dc966c59f0f04f34d1f8d701eeb2102464ba8a7e03 lib/core/settings.py
191+
5c00a2972dd47b9ffadf18d85914ad2a26eb137303003efe9e7dbf833620654e lib/core/settings.py
192192
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
193193
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
194194
d35650179816193164a5f177102f18379dfbe6bb6d40fbb67b78d907b41c8038 lib/core/target.py

lib/core/common.py

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4512,34 +4512,32 @@ def randomizeParameterValue(value):
45124512

45134513
retVal = value
45144514

4515-
value = re.sub(r"%[0-9a-fA-F]{2}", "", value)
4515+
retVal = re.sub(r"%[0-9a-fA-F]{2}", "", retVal)
45164516

4517-
for match in re.finditer(r"[A-Z]+", value):
4517+
def _replace_upper(match):
4518+
original = match.group()
45184519
while True:
4519-
original = match.group()
4520-
candidate = randomStr(len(match.group())).upper()
4521-
if original != candidate:
4522-
break
4523-
4524-
retVal = retVal.replace(original, candidate)
4520+
candidate = randomStr(len(original)).upper()
4521+
if candidate != original:
4522+
return candidate
45254523

4526-
for match in re.finditer(r"[a-z]+", value):
4524+
def _replace_lower(match):
4525+
original = match.group()
45274526
while True:
4528-
original = match.group()
4529-
candidate = randomStr(len(match.group())).lower()
4530-
if original != candidate:
4531-
break
4527+
candidate = randomStr(len(original)).lower()
4528+
if candidate != original:
4529+
return candidate
45324530

4533-
retVal = retVal.replace(original, candidate)
4534-
4535-
for match in re.finditer(r"[0-9]+", value):
4531+
def _replace_digit(match):
4532+
original = match.group()
45364533
while True:
4537-
original = match.group()
4538-
candidate = str(randomInt(len(match.group())))
4539-
if original != candidate:
4540-
break
4534+
candidate = str(randomInt(len(original)))
4535+
if candidate != original:
4536+
return candidate
45414537

4542-
retVal = retVal.replace(original, candidate, 1)
4538+
retVal = re.sub(r"[A-Z]+", _replace_upper, retVal)
4539+
retVal = re.sub(r"[a-z]+", _replace_lower, retVal)
4540+
retVal = re.sub(r"[0-9]+", _replace_digit, retVal)
45434541

45444542
if re.match(r"\A[^@]+@.+\.[a-z]+\Z", value):
45454543
parts = retVal.split('.')

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from thirdparty import six
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.10.1.67"
22+
VERSION = "1.10.1.68"
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)

0 commit comments

Comments
 (0)