This commit is contained in:
Miroslav Stampar 2020-12-25 23:24:59 +01:00
parent 99e6d56f09
commit 8c8aae9170
4 changed files with 9 additions and 6 deletions

View File

@ -12,6 +12,7 @@ import codecs
import collections import collections
import contextlib import contextlib
import copy import copy
import distutils.version
import functools import functools
import getpass import getpass
import hashlib import hashlib
@ -586,7 +587,7 @@ class Backend(object):
@staticmethod @staticmethod
def isVersionGreaterOrEqualThan(version): def isVersionGreaterOrEqualThan(version):
return Backend.getVersion() is not None and str(Backend.getVersion()) >= str(version) return Backend.getVersion() is not None and version is not None and distutils.version.LooseVersion(str(Backend.getVersion()) or ' ') >= distutils.version.LooseVersion(str(version) or ' ')
@staticmethod @staticmethod
def isOs(os): def isOs(os):

View File

@ -18,7 +18,7 @@ from lib.core.enums import OS
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.4.12.34" VERSION = "1.4.12.35"
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

@ -5,6 +5,7 @@ Copyright (c) 2006-2020 sqlmap developers (http://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
@ -37,13 +38,13 @@ class Takeover(GenericTakeover):
banVer = kb.bannerFp["dbmsVersion"] banVer = kb.bannerFp["dbmsVersion"]
if banVer >= "5.0.67": if distutils.version.LooseVersion(banVer) >= distutils.version.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 banVer >= "5.1.19": if self.__plugindir is None and distutils.version.LooseVersion(banVer) >= distutils.version.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,6 +5,7 @@ Copyright (c) 2006-2020 sqlmap developers (http://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
@ -50,9 +51,9 @@ class Takeover(GenericTakeover):
banVer = kb.bannerFp["dbmsVersion"] banVer = kb.bannerFp["dbmsVersion"]
if banVer >= "10": if distutils.version.LooseVersion(banVer) >= distutils.version.LooseVersion("10"):
majorVer = banVer.split('.')[0] majorVer = banVer.split('.')[0]
elif banVer >= "8.2" and '.' in banVer: elif distutils.version.LooseVersion(banVer) >= distutils.version.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"