This commit is contained in:
Miroslav Stampar 2021-10-07 00:29:31 +02:00
parent 7d31de1124
commit 69900a6c6e
8 changed files with 18 additions and 14 deletions

View File

@ -11,7 +11,6 @@ import binascii
import codecs import codecs
import contextlib import contextlib
import copy import copy
import distutils.version
import functools import functools
import getpass import getpass
import hashlib import hashlib
@ -47,6 +46,7 @@ from extra.beep.beep import beep
from extra.cloak.cloak import decloak from extra.cloak.cloak import decloak
from lib.core.bigarray import BigArray from lib.core.bigarray import BigArray
from lib.core.compat import cmp from lib.core.compat import cmp
from lib.core.compat import LooseVersion
from lib.core.compat import round from lib.core.compat import round
from lib.core.compat import xrange from lib.core.compat import xrange
from lib.core.convert import base64pickle from lib.core.convert import base64pickle
@ -591,7 +591,7 @@ class Backend(object):
if Backend.getVersion() is not None and version is not None: if Backend.getVersion() is not None and version is not None:
try: try:
retVal = distutils.version.LooseVersion(Backend.getVersion()) >= distutils.version.LooseVersion(version) retVal = LooseVersion(Backend.getVersion()) >= LooseVersion(version)
except: except:
retVal = str(Backend.getVersion()) >= str(version) retVal = str(Backend.getVersion()) >= str(version)

View File

@ -257,3 +257,8 @@ if sys.version_info >= (3, 0):
else: else:
xrange = xrange xrange = xrange
buffer = buffer buffer = buffer
try:
from pkg_resources import parse_version as LooseVersion
except ImportError:
from distutils.version import LooseVersion

View File

@ -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.5.10.5" VERSION = "1.5.10.6"
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)

View File

@ -24,7 +24,6 @@ from lib.core.common import randomInt
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.common import shellExec from lib.core.common import shellExec
from lib.core.compat import round from lib.core.compat import round
from lib.core.compat import xrange
from lib.core.convert import encodeBase64 from lib.core.convert import encodeBase64
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger

View File

@ -5,12 +5,12 @@ Copyright (c) 2006-2021 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
import distutils.version
import re import re
import socket import socket
from lib.core.common import filterNone from lib.core.common import filterNone
from lib.core.common import getSafeExString from lib.core.common import getSafeExString
from lib.core.compat import LooseVersion
from lib.core.compat import xrange from lib.core.compat import xrange
from lib.core.data import conf from lib.core.data import conf
from lib.core.data import kb from lib.core.data import kb
@ -109,7 +109,7 @@ class HTTPSConnection(_http_client.HTTPSConnection):
if not success: if not success:
errMsg = "can't establish SSL connection" errMsg = "can't establish SSL connection"
# Reference: https://docs.python.org/2/library/ssl.html # Reference: https://docs.python.org/2/library/ssl.html
if distutils.version.LooseVersion(PYVERSION) < distutils.version.LooseVersion("2.7.9"): if LooseVersion(PYVERSION) < LooseVersion("2.7.9"):
errMsg += " (please retry with Python >= 2.7.9)" errMsg += " (please retry with Python >= 2.7.9)"
if kb.sslSuccess and not self.retrying: if kb.sslSuccess and not self.retrying:

View File

@ -5,7 +5,6 @@ Copyright (c) 2006-2021 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
import distutils.version
import os import os
from lib.core.agent import agent from lib.core.agent import agent
@ -17,6 +16,7 @@ from lib.core.common import normalizePath
from lib.core.common import ntToPosixSlashes from lib.core.common import ntToPosixSlashes
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.common import unArrayizeValue from lib.core.common import unArrayizeValue
from lib.core.compat import LooseVersion
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.data import paths from lib.core.data import paths
@ -38,13 +38,13 @@ class Takeover(GenericTakeover):
banVer = kb.bannerFp["dbmsVersion"] banVer = kb.bannerFp["dbmsVersion"]
if banVer and distutils.version.LooseVersion(banVer) >= distutils.version.LooseVersion("5.0.67"): if banVer and LooseVersion(banVer) >= LooseVersion("5.0.67"):
if self.__plugindir is None: if self.__plugindir is None:
logger.info("retrieving MySQL plugin directory absolute path") logger.info("retrieving MySQL plugin directory absolute path")
self.__plugindir = unArrayizeValue(inject.getValue("SELECT @@plugin_dir")) self.__plugindir = unArrayizeValue(inject.getValue("SELECT @@plugin_dir"))
# On MySQL 5.1 >= 5.1.19 and on any version of MySQL 6.0 # On MySQL 5.1 >= 5.1.19 and on any version of MySQL 6.0
if self.__plugindir is None and distutils.version.LooseVersion(banVer) >= distutils.version.LooseVersion("5.1.19"): if self.__plugindir is None and LooseVersion(banVer) >= LooseVersion("5.1.19"):
logger.info("retrieving MySQL base directory absolute path") logger.info("retrieving MySQL base directory absolute path")
# Reference: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_basedir # Reference: http://dev.mysql.com/doc/refman/5.1/en/server-options.html#option_mysqld_basedir

View File

@ -5,7 +5,6 @@ Copyright (c) 2006-2021 sqlmap developers (https://sqlmap.org/)
See the file 'LICENSE' for copying permission See the file 'LICENSE' for copying permission
""" """
import distutils.version
import os import os
from lib.core.common import Backend from lib.core.common import Backend
@ -17,6 +16,7 @@ from lib.core.common import isListLike
from lib.core.common import isNoneValue from lib.core.common import isNoneValue
from lib.core.common import isStackingAvailable from lib.core.common import isStackingAvailable
from lib.core.common import randomStr from lib.core.common import randomStr
from lib.core.compat import LooseVersion
from lib.core.data import kb from lib.core.data import kb
from lib.core.data import logger from lib.core.data import logger
from lib.core.data import paths from lib.core.data import paths
@ -54,9 +54,9 @@ class Takeover(GenericTakeover):
if not banVer or not banVer[0].isdigit(): if not banVer or not banVer[0].isdigit():
errMsg = "unsupported feature on unknown version of PostgreSQL" errMsg = "unsupported feature on unknown version of PostgreSQL"
raise SqlmapUnsupportedFeatureException(errMsg) raise SqlmapUnsupportedFeatureException(errMsg)
elif distutils.version.LooseVersion(banVer) >= distutils.version.LooseVersion("10"): elif LooseVersion(banVer) >= LooseVersion("10"):
majorVer = banVer.split('.')[0] majorVer = banVer.split('.')[0]
elif distutils.version.LooseVersion(banVer) >= distutils.version.LooseVersion("8.2") and '.' in banVer: elif LooseVersion(banVer) >= LooseVersion("8.2") and '.' in banVer:
majorVer = '.'.join(banVer.split('.')[:2]) majorVer = '.'.join(banVer.split('.')[:2])
else: else:
errMsg = "unsupported feature on versions of PostgreSQL before 8.2" errMsg = "unsupported feature on versions of PostgreSQL before 8.2"

View File

@ -18,7 +18,6 @@ try:
sys.exit("[!] wrong installation detected (missing modules). Visit 'https://github.com/sqlmapproject/sqlmap/#installation' for further details") sys.exit("[!] wrong installation detected (missing modules). Visit 'https://github.com/sqlmapproject/sqlmap/#installation' for further details")
import bdb import bdb
import distutils
import glob import glob
import inspect import inspect
import json import json
@ -64,6 +63,7 @@ try:
from lib.core.common import MKSTEMP_PREFIX from lib.core.common import MKSTEMP_PREFIX
from lib.core.common import setColor from lib.core.common import setColor
from lib.core.common import unhandledExceptionMessage from lib.core.common import unhandledExceptionMessage
from lib.core.compat import LooseVersion
from lib.core.compat import xrange from lib.core.compat import xrange
from lib.core.exception import SqlmapBaseException from lib.core.exception import SqlmapBaseException
from lib.core.exception import SqlmapShellQuitException from lib.core.exception import SqlmapShellQuitException
@ -114,7 +114,7 @@ def checkEnvironment():
logger.critical(errMsg) logger.critical(errMsg)
raise SystemExit raise SystemExit
if distutils.version.LooseVersion(VERSION) < distutils.version.LooseVersion("1.0"): if LooseVersion(VERSION) < LooseVersion("1.0"):
errMsg = "your runtime environment (e.g. PYTHONPATH) is " errMsg = "your runtime environment (e.g. PYTHONPATH) is "
errMsg += "broken. Please make sure that you are not running " errMsg += "broken. Please make sure that you are not running "
errMsg += "newer versions of sqlmap with runtime scripts for older " errMsg += "newer versions of sqlmap with runtime scripts for older "