mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 01:26:42 +03:00
Fixes #5268
This commit is contained in:
parent
4cd146cc86
commit
dd4010f16f
|
@ -12,6 +12,7 @@ import functools
|
||||||
import math
|
import math
|
||||||
import os
|
import os
|
||||||
import random
|
import random
|
||||||
|
import re
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
import uuid
|
import uuid
|
||||||
|
@ -277,8 +278,37 @@ else:
|
||||||
xrange = xrange
|
xrange = xrange
|
||||||
buffer = buffer
|
buffer = buffer
|
||||||
|
|
||||||
try:
|
def LooseVersion(version):
|
||||||
from packaging import version
|
"""
|
||||||
LooseVersion = version.parse
|
>>> LooseVersion("1.0") == LooseVersion("1.0")
|
||||||
except ImportError:
|
True
|
||||||
from distutils.version import LooseVersion
|
>>> 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")
|
||||||
|
True
|
||||||
|
>>> LooseVersion("8.0.22-0ubuntu0.20.04.2")
|
||||||
|
8.000022
|
||||||
|
"""
|
||||||
|
|
||||||
|
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
|
||||||
|
else:
|
||||||
|
result = float("NaN")
|
||||||
|
|
||||||
|
return result
|
||||||
|
|
|
@ -20,7 +20,7 @@ from thirdparty import six
|
||||||
from thirdparty.six import unichr as _unichr
|
from thirdparty.six import unichr as _unichr
|
||||||
|
|
||||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||||
VERSION = "1.6.12.8"
|
VERSION = "1.6.12.9"
|
||||||
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)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user