mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 05:04:11 +03:00
Added a check for an Issue #361
This commit is contained in:
parent
1c47b33020
commit
9ccbdb3fdf
|
@ -6,6 +6,7 @@ See the file 'doc/COPYING' for copying permission
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import imp
|
import imp
|
||||||
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
_sqlalchemy = None
|
_sqlalchemy = None
|
||||||
|
@ -18,6 +19,7 @@ except ImportError:
|
||||||
from lib.core.data import conf
|
from lib.core.data import conf
|
||||||
from lib.core.data import logger
|
from lib.core.data import logger
|
||||||
from lib.core.exception import SqlmapConnectionException
|
from lib.core.exception import SqlmapConnectionException
|
||||||
|
from lib.core.exception import SqlmapFilePathException
|
||||||
from plugins.generic.connector import Connector as GenericConnector
|
from plugins.generic.connector import Connector as GenericConnector
|
||||||
|
|
||||||
class SQLAlchemy(GenericConnector):
|
class SQLAlchemy(GenericConnector):
|
||||||
|
@ -32,12 +34,19 @@ class SQLAlchemy(GenericConnector):
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not self.port and self.db:
|
if not self.port and self.db:
|
||||||
if "///" not in conf.direct:
|
if not os.path.exists(self.db):
|
||||||
conf.direct = conf.direct.replace("//", "///", 1)
|
raise SqlmapFilePathException, "missing database file '%s'" % self.db
|
||||||
|
|
||||||
|
_ = conf.direct.split("//", 1)
|
||||||
|
conf.direct = "%s////%s" % (_[0], os.path.abspath(self.db))
|
||||||
|
|
||||||
if self.dialect:
|
if self.dialect:
|
||||||
conf.direct = conf.direct.replace(conf.dbms, self.dialect)
|
conf.direct = conf.direct.replace(conf.dbms, self.dialect)
|
||||||
|
|
||||||
engine = _sqlalchemy.create_engine(conf.direct, connect_args={'check_same_thread':False} if self.dialect == "sqlite" else {})
|
engine = _sqlalchemy.create_engine(conf.direct, connect_args={'check_same_thread':False} if self.dialect == "sqlite" else {})
|
||||||
self.connection = engine.connect()
|
self.connection = engine.connect()
|
||||||
|
except SqlmapFilePathException:
|
||||||
|
raise
|
||||||
except Exception, msg:
|
except Exception, msg:
|
||||||
raise SqlmapConnectionException(msg[0])
|
raise SqlmapConnectionException(msg[0])
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user