This commit is contained in:
Miroslav Stampar 2020-06-24 12:05:40 +02:00
parent 31bf1fc6b6
commit 050700f079
2 changed files with 12 additions and 9 deletions

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.6.13" VERSION = "1.4.6.14"
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

@ -8,6 +8,7 @@ See the file 'LICENSE' for copying permission
import imp import imp
import logging import logging
import os import os
import re
import sys import sys
import traceback import traceback
import warnings import warnings
@ -41,7 +42,12 @@ def getSafeExString(ex, encoding=None): # Cross-referenced function
class SQLAlchemy(GenericConnector): class SQLAlchemy(GenericConnector):
def __init__(self, dialect=None): def __init__(self, dialect=None):
GenericConnector.__init__(self) GenericConnector.__init__(self)
self.dialect = dialect self.dialect = dialect
self.address = conf.direct
if self.dialect:
self.address = re.sub(r"\A.+://", "%s://" % self.dialect, self.address)
def connect(self): def connect(self):
if _sqlalchemy: if _sqlalchemy:
@ -52,18 +58,15 @@ class SQLAlchemy(GenericConnector):
if not os.path.exists(self.db): if not os.path.exists(self.db):
raise SqlmapFilePathException("the provided database file '%s' does not exist" % self.db) raise SqlmapFilePathException("the provided database file '%s' does not exist" % self.db)
_ = conf.direct.split("//", 1) _ = self.address.split("//", 1)
conf.direct = "%s////%s" % (_[0], os.path.abspath(self.db)) self.address = "%s////%s" % (_[0], os.path.abspath(self.db))
if self.dialect:
conf.direct = conf.direct.replace(conf.dbms, self.dialect, 1)
if self.dialect == "sqlite": if self.dialect == "sqlite":
engine = _sqlalchemy.create_engine(conf.direct, connect_args={"check_same_thread": False}) engine = _sqlalchemy.create_engine(self.address, connect_args={"check_same_thread": False})
elif self.dialect == "oracle": elif self.dialect == "oracle":
engine = _sqlalchemy.create_engine(conf.direct) engine = _sqlalchemy.create_engine(self.address)
else: else:
engine = _sqlalchemy.create_engine(conf.direct, connect_args={}) engine = _sqlalchemy.create_engine(self.address, connect_args={})
self.connector = engine.connect() self.connector = engine.connect()
except (TypeError, ValueError): except (TypeError, ValueError):