From 899447fbae7da4420550fd68d715df2f4667ca18 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0tampar?= Date: Fri, 5 Jun 2026 13:46:14 +0200 Subject: [PATCH] Improvement of compat/LooseVersion --- data/txt/sha256sums.txt | 4 ++-- lib/core/compat.py | 26 +++++--------------------- lib/core/settings.py | 2 +- 3 files changed, 8 insertions(+), 24 deletions(-) diff --git a/data/txt/sha256sums.txt b/data/txt/sha256sums.txt index df016348e..74d072716 100644 --- a/data/txt/sha256sums.txt +++ b/data/txt/sha256sums.txt @@ -168,7 +168,7 @@ d69e84f1648cdb907f5d2dd454f03874a4613752b07867510145d51d84b3c56f lib/controller b2555d11529689f5d7d02bee0741d3228969e2bf29a2b9140bf1560ff60249e7 lib/core/agent.py b13462712ec5ac07541dba98631ddcda279d210b838f363d15ac97a1413b67a2 lib/core/bigarray.py df59ab7c23d2cf96ea951a9a91f95865b79008ff4131e9178b346e274d920dff lib/core/common.py -a6397b10de7ae7c56ed6b0fa3b3c58eb7a9dbede61bf93d786e73258175c981e lib/core/compat.py +f30b4eccdb574731fa7e6ef48e71ea82d4bc99be70a2e27bff230943e9039313 lib/core/compat.py e37bfd314a46699b14e1c8a5ea851d546d3a36bea8e5f37466ef2921ff78fefd lib/core/convert.py c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data.py 6acb645b1f285b21673c70824b03f6209acc5993b50e50da5ed2c713a30626f5 lib/core/datatype.py @@ -188,7 +188,7 @@ c03dc585f89642cfd81b087ac2723e3e1bb3bfa8c60e6f5fe58ef3b0113ebfe6 lib/core/data. 48797d6c34dd9bb8a53f7f3794c85f4288d82a9a1d6be7fcf317d388cb20d4b3 lib/core/replication.py 0b8c38a01bb01f843d94a6c5f2075ee47520d0c4aa799cecea9c3e2c5a4a23a6 lib/core/revision.py 888daba83fd4a34e9503fe21f01fef4cc730e5cde871b1d40e15d4cbc847d56c lib/core/session.py -137217753ef641cf3c1488a9f3b39f4097fa471579263922f6ad4bcdb976ba03 lib/core/settings.py +e6c3dfc0f97da5075c618e81d2737f2069d6b9cc21e77c2c63c120d2e11c1b43 lib/core/settings.py cd5a66deee8963ba8e7e9af3dd36eb5e8127d4d68698811c29e789655f507f82 lib/core/shell.py bcb5d8090d5e3e0ef2a586ba09ba80eef0c6d51feb0f611ed25299fbb254f725 lib/core/subprocessng.py 70ea3768f1b3062b22d20644df41c86238157ec80dd43da40545c620714273c6 lib/core/target.py diff --git a/lib/core/compat.py b/lib/core/compat.py index 7020863da..681670332 100644 --- a/lib/core/compat.py +++ b/lib/core/compat.py @@ -286,34 +286,18 @@ def LooseVersion(version): True >>> LooseVersion("1.0.1") > LooseVersion("1.0") True - >>> LooseVersion("1.0.1-") == LooseVersion("1.0.1") - True >>> LooseVersion("1.0.11") < LooseVersion("1.0.111") True - >>> LooseVersion("foobar") > LooseVersion("1.0") - False - >>> LooseVersion("1.0") > LooseVersion("foobar") - False - >>> LooseVersion("3.22-mysql") == LooseVersion("3.22-mysql-ubuntu0.3") + >>> LooseVersion("8.0.22") > LooseVersion("8.0.2") True - >>> LooseVersion("8.0.22-0ubuntu0.20.04.2") - 8.000022 + >>> LooseVersion("1.0alpha-beta-gama") + (1, 0) """ - match = re.search(r"\A(\d[\d.]*)", version or "") - if match: - result = 0 - value = match.group(1) - weight = 1.0 - for part in value.strip('.').split('.'): - if part.isdigit(): - result += int(part) * weight - weight *= 1e-3 + return tuple(int(part) for part in match.group(1).strip('.').split('.') if part.isdigit()) else: - result = float("NaN") - - return result + return () # NOTE: codecs.open re-implementation (deprecated in Python 3.14) diff --git a/lib/core/settings.py b/lib/core/settings.py index 273f8d730..a580d3e06 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from lib.core.enums import OS from thirdparty import six # sqlmap version (...) -VERSION = "1.10.6.47" +VERSION = "1.10.6.48" 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)