mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-16 19:40:37 +03:00
Fixes #4237
This commit is contained in:
parent
31bf1fc6b6
commit
050700f079
|
@ -18,7 +18,7 @@ from lib.core.enums import OS
|
|||
from thirdparty.six import unichr as _unichr
|
||||
|
||||
# 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_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)
|
||||
|
|
|
@ -8,6 +8,7 @@ See the file 'LICENSE' for copying permission
|
|||
import imp
|
||||
import logging
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
import traceback
|
||||
import warnings
|
||||
|
@ -41,7 +42,12 @@ def getSafeExString(ex, encoding=None): # Cross-referenced function
|
|||
class SQLAlchemy(GenericConnector):
|
||||
def __init__(self, dialect=None):
|
||||
GenericConnector.__init__(self)
|
||||
|
||||
self.dialect = dialect
|
||||
self.address = conf.direct
|
||||
|
||||
if self.dialect:
|
||||
self.address = re.sub(r"\A.+://", "%s://" % self.dialect, self.address)
|
||||
|
||||
def connect(self):
|
||||
if _sqlalchemy:
|
||||
|
@ -52,18 +58,15 @@ class SQLAlchemy(GenericConnector):
|
|||
if not os.path.exists(self.db):
|
||||
raise SqlmapFilePathException("the provided database file '%s' does not exist" % self.db)
|
||||
|
||||
_ = conf.direct.split("//", 1)
|
||||
conf.direct = "%s////%s" % (_[0], os.path.abspath(self.db))
|
||||
|
||||
if self.dialect:
|
||||
conf.direct = conf.direct.replace(conf.dbms, self.dialect, 1)
|
||||
_ = self.address.split("//", 1)
|
||||
self.address = "%s////%s" % (_[0], os.path.abspath(self.db))
|
||||
|
||||
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":
|
||||
engine = _sqlalchemy.create_engine(conf.direct)
|
||||
engine = _sqlalchemy.create_engine(self.address)
|
||||
else:
|
||||
engine = _sqlalchemy.create_engine(conf.direct, connect_args={})
|
||||
engine = _sqlalchemy.create_engine(self.address, connect_args={})
|
||||
|
||||
self.connector = engine.connect()
|
||||
except (TypeError, ValueError):
|
||||
|
|
Loading…
Reference in New Issue
Block a user