Minor optimization of randomizeParameterValue

This commit is contained in:
Miroslav Stampar 2026-01-28 18:53:00 +01:00
parent fbee649fb6
commit cd6e2f1c8a
3 changed files with 22 additions and 24 deletions

View File

@ -167,7 +167,7 @@ e376093d4f6e42ee38b050af329179df9c1c136b7667b2f1cb559f5d4b69ebd9 lib/controller
1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/controller/__init__.py 1966ca704961fb987ab757f0a4afddbf841d1a880631b701487c75cef63d60c3 lib/controller/__init__.py
2a96190ced25d8929861b13866101812fcadf5cac23dd1dd4b29b1a915918769 lib/core/agent.py 2a96190ced25d8929861b13866101812fcadf5cac23dd1dd4b29b1a915918769 lib/core/agent.py
b13462712ec5ac07541dba98631ddcda279d210b838f363d15ac97a1413b67a2 lib/core/bigarray.py b13462712ec5ac07541dba98631ddcda279d210b838f363d15ac97a1413b67a2 lib/core/bigarray.py
28c5189446a642c8ee0a887b150b96ca9a05ad32e57240e1e5195e8217dfa388 lib/core/common.py f7ae9ac5ab4abb7e0a485a7fdebcf3588b64e8f0662e14b569015429535e3116 lib/core/common.py
a6397b10de7ae7c56ed6b0fa3b3c58eb7a9dbede61bf93d786e73258175c981e lib/core/compat.py a6397b10de7ae7c56ed6b0fa3b3c58eb7a9dbede61bf93d786e73258175c981e lib/core/compat.py
a9997e97ebe88e0bf7efcf21e878bc5f62c72348e5aba18f64d6861390a4dcf2 lib/core/convert.py a9997e97ebe88e0bf7efcf21e878bc5f62c72348e5aba18f64d6861390a4dcf2 lib/core/convert.py
c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data.py c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data.py
@ -188,7 +188,7 @@ a033f92d136c707a25927c2383125ddb004d4283db62c004dcd67c3fc242bb1c lib/core/dump.
48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py 48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py
0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py 0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py
888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py 888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py
94f6f12a431c34d4cfa821dc966c59f0f04f34d1f8d701eeb2102464ba8a7e03 lib/core/settings.py 5c00a2972dd47b9ffadf18d85914ad2a26eb137303003efe9e7dbf833620654e lib/core/settings.py
cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py
bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py
d35650179816193164a5f177102f18379dfbe6bb6d40fbb67b78d907b41c8038 lib/core/target.py d35650179816193164a5f177102f18379dfbe6bb6d40fbb67b78d907b41c8038 lib/core/target.py

View File

@ -4512,34 +4512,32 @@ def randomizeParameterValue(value):
retVal = value retVal = value
value = re.sub(r"%[0-9a-fA-F]{2}", "", value) retVal = re.sub(r"%[0-9a-fA-F]{2}", "", retVal)
for match in re.finditer(r"[A-Z]+", value): def _replace_upper(match):
original = match.group()
while True: while True:
original = match.group() candidate = randomStr(len(original)).upper()
candidate = randomStr(len(match.group())).upper() if candidate != original:
if original != candidate: return candidate
break
retVal = retVal.replace(original, candidate) def _replace_lower(match):
original = match.group()
for match in re.finditer(r"[a-z]+", value):
while True: while True:
original = match.group() candidate = randomStr(len(original)).lower()
candidate = randomStr(len(match.group())).lower() if candidate != original:
if original != candidate: return candidate
break
retVal = retVal.replace(original, candidate) def _replace_digit(match):
original = match.group()
for match in re.finditer(r"[0-9]+", value):
while True: while True:
original = match.group() candidate = str(randomInt(len(original)))
candidate = str(randomInt(len(match.group()))) if candidate != original:
if original != candidate: return candidate
break
retVal = retVal.replace(original, candidate, 1) retVal = re.sub(r"[A-Z]+", _replace_upper, retVal)
retVal = re.sub(r"[a-z]+", _replace_lower, retVal)
retVal = re.sub(r"[0-9]+", _replace_digit, retVal)
if re.match(r"\A[^@]+@.+\.[a-z]+\Z", value): if re.match(r"\A[^@]+@.+\.[a-z]+\Z", value):
parts = retVal.split('.') parts = retVal.split('.')

View File

@ -19,7 +19,7 @@ from lib.core.enums import OS
from thirdparty import six from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>) # sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.1.67" VERSION = "1.10.1.68"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable" TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34} TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE) VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)