Minor optimization of findMultipartPostBoundary

This commit is contained in:
Miroslav Stampar
2026-01-28 18:46:59 +01:00
parent 600823f7c1
commit 362f7aae0a
3 changed files with 9 additions and 16 deletions

View File

@@ -2923,22 +2923,15 @@ def findMultipartPostBoundary(post):
"""
retVal = None
done = set()
candidates = []
counts = {}
for match in re.finditer(r"(?m)^--(.+?)(--)?$", post or ""):
_ = match.group(1).strip().strip('-')
boundary = match.group(1).strip().strip('-')
counts[boundary] = counts.get(boundary, 0) + 1
if _ in done:
continue
else:
candidates.append((post.count(_), _))
done.add(_)
if candidates:
candidates.sort(key=lambda _: _[0], reverse=True)
retVal = candidates[0][1]
if counts:
sorted_boundaries = sorted(counts.items(), key=lambda x: x[1], reverse=True)
retVal = sorted_boundaries[0][0]
return retVal

View File

@@ -19,7 +19,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.1.65"
VERSION = "1.10.1.66"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
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)