mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-21 05:50: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
|
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)
|
||||||
|
|
|
@ -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):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user