From 1be7a5aea88fabe4da716dc0193074b58698034d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 23 Jan 2023 16:21:46 +0100 Subject: [PATCH] Fixes #4870 --- lib/core/settings.py | 2 +- lib/utils/sqlalchemy.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/core/settings.py b/lib/core/settings.py index 05c2618db..9c99f41a6 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -20,7 +20,7 @@ from thirdparty import six from thirdparty.six import unichr as _unichr # sqlmap version (...) -VERSION = "1.7.1.6" +VERSION = "1.7.1.7" 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) diff --git a/lib/utils/sqlalchemy.py b/lib/utils/sqlalchemy.py index 2d5b2e161..73789ba51 100644 --- a/lib/utils/sqlalchemy.py +++ b/lib/utils/sqlalchemy.py @@ -39,6 +39,7 @@ from lib.core.exception import SqlmapFilePathException from lib.core.exception import SqlmapMissingDependence from plugins.generic.connector import Connector as GenericConnector from thirdparty import six +from thirdparty.six.moves import urllib as _urllib def getSafeExString(ex, encoding=None): # Cross-referenced function raise NotImplementedError @@ -50,6 +51,12 @@ class SQLAlchemy(GenericConnector): self.dialect = dialect self.address = conf.direct + if conf.dbmsUser: + self.address = self.address.replace("%s:" % conf.dbmsUser, "%s:" % _urllib.parse.quote(conf.dbmsUser)) + + if conf.dbmsPass: + self.address = self.address.replace(":%s@" % conf.dbmsPass, ":%s@" % _urllib.parse.quote(conf.dbmsPass)) + if self.dialect: self.address = re.sub(r"\A.+://", "%s://" % self.dialect, self.address)