File tree Expand file tree Collapse file tree 2 files changed +36
-6
lines changed
Expand file tree Collapse file tree 2 files changed +36
-6
lines changed Original file line number Diff line number Diff line change 1212import math
1313import os
1414import random
15+ import re
1516import sys
1617import time
1718import uuid
@@ -277,8 +278,37 @@ def __hash__(self):
277278 xrange = xrange
278279 buffer = buffer
279280
280- try :
281- from packaging import version
282- LooseVersion = version .parse
283- except ImportError :
284- from distutils .version import LooseVersion
281+ def LooseVersion (version ):
282+ """
283+ >>> LooseVersion("1.0") == LooseVersion("1.0")
284+ True
285+ >>> LooseVersion("1.0.1") > LooseVersion("1.0")
286+ True
287+ >>> LooseVersion("1.0.1-") == LooseVersion("1.0.1")
288+ True
289+ >>> LooseVersion("1.0.11") < LooseVersion("1.0.111")
290+ True
291+ >>> LooseVersion("foobar") > LooseVersion("1.0")
292+ False
293+ >>> LooseVersion("1.0") > LooseVersion("foobar")
294+ False
295+ >>> LooseVersion("3.22-mysql") == LooseVersion("3.22-mysql-ubuntu0.3")
296+ True
297+ >>> LooseVersion("8.0.22-0ubuntu0.20.04.2")
298+ 8.000022
299+ """
300+
301+ match = re .search (r"\A(\d[\d.]*)" , version or "" )
302+
303+ if match :
304+ result = 0
305+ value = match .group (1 )
306+ weight = 1.0
307+ for part in value .strip ('.' ).split ('.' ):
308+ if part .isdigit ():
309+ result += int (part ) * weight
310+ weight *= 1e-3
311+ else :
312+ result = float ("NaN" )
313+
314+ return result
Original file line number Diff line number Diff line change 2020from thirdparty .six import unichr as _unichr
2121
2222# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
23- VERSION = "1.6.12.8 "
23+ VERSION = "1.6.12.9 "
2424TYPE = "dev" if VERSION .count ('.' ) > 2 and VERSION .split ('.' )[- 1 ] != '0' else "stable"
2525TYPE_COLORS = {"dev" : 33 , "stable" : 90 , "pip" : 34 }
2626VERSION_STRING = "sqlmap/%s#%s" % ('.' .join (VERSION .split ('.' )[:- 1 ]) if VERSION .count ('.' ) > 2 and VERSION .split ('.' )[- 1 ] == '0' else VERSION , TYPE )
You can’t perform that action at this time.
0 commit comments