mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-08-04 14:55:40 +00:00
Some more patches for -d
This commit is contained in:
parent
e23a91f6db
commit
d5ff557a13
9 changed files with 70 additions and 9 deletions
|
|
@ -38,7 +38,9 @@ class Connector(GenericConnector):
|
|||
self.checkFileDb()
|
||||
|
||||
try:
|
||||
self.connector = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb)};Dbq=%s;Uid=Admin;Pwd=;' % self.db)
|
||||
# ACE driver ('*.mdb, *.accdb') handles both legacy Jet .mdb and modern .accdb (the old '*.mdb'-only
|
||||
# Jet driver is 32-bit-only and absent on modern installs); honor supplied credentials, not Admin/empty
|
||||
self.connector = pyodbc.connect('Driver={Microsoft Access Driver (*.mdb, *.accdb)};Dbq=%s;Uid=%s;Pwd=%s;' % (self.db, self.user or "Admin", self.password or ""))
|
||||
except (pyodbc.Error, pyodbc.OperationalError) as ex:
|
||||
raise SqlmapConnectionException(getSafeExString(ex))
|
||||
|
||||
|
|
|
|||
|
|
@ -5,7 +5,51 @@ Copyright (c) 2006-2026 sqlmap developers (https://sqlmap.org)
|
|||
See the file 'LICENSE' for copying permission
|
||||
"""
|
||||
|
||||
try:
|
||||
import clickhouse_connect
|
||||
import clickhouse_connect.dbapi
|
||||
except:
|
||||
pass
|
||||
|
||||
import logging
|
||||
|
||||
from lib.core.common import getSafeExString
|
||||
from lib.core.data import conf
|
||||
from lib.core.data import logger
|
||||
from lib.core.exception import SqlmapConnectionException
|
||||
from plugins.generic.connector import Connector as GenericConnector
|
||||
|
||||
class Connector(GenericConnector):
|
||||
pass
|
||||
"""
|
||||
Homepage: https://github.com/ClickHouse/clickhouse-connect
|
||||
User guide: https://clickhouse.com/docs/integrations/python
|
||||
License: Apache 2.0
|
||||
"""
|
||||
|
||||
def connect(self):
|
||||
self.initConnection()
|
||||
|
||||
try:
|
||||
self.connector = clickhouse_connect.dbapi.connect(host=self.hostname, port=self.port, username=self.user, password=self.password, database=self.db)
|
||||
except clickhouse_connect.dbapi.Error as ex:
|
||||
raise SqlmapConnectionException(getSafeExString(ex))
|
||||
|
||||
self.initCursor()
|
||||
self.printConnected()
|
||||
|
||||
def fetchall(self):
|
||||
try:
|
||||
return self.cursor.fetchall()
|
||||
except clickhouse_connect.dbapi.Error as ex:
|
||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
|
||||
return None
|
||||
|
||||
def execute(self, query):
|
||||
try:
|
||||
self.cursor.execute(query)
|
||||
except clickhouse_connect.dbapi.Error as ex:
|
||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % getSafeExString(ex))
|
||||
|
||||
def select(self, query):
|
||||
self.execute(query)
|
||||
return self.fetchall()
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Connector(GenericConnector):
|
|||
try:
|
||||
database = "DRIVER={IBM DB2 ODBC DRIVER};DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;" % (self.db, self.hostname, self.port)
|
||||
self.connector = ibm_db_dbi.connect(database, self.user, self.password)
|
||||
except ibm_db_dbi.OperationalError as ex:
|
||||
except ibm_db_dbi.Error as ex: # base class: ibm_db_dbi maps wrong-credential (SQLSTATE 28) to ProgrammingError, not OperationalError
|
||||
raise SqlmapConnectionException(getSafeExString(ex))
|
||||
|
||||
self.initCursor()
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ class Connector(GenericConnector):
|
|||
self.initConnection()
|
||||
|
||||
try:
|
||||
self.connector = drda.connect(host=self.hostname, database=self.db, port=self.port)
|
||||
self.connector = drda.connect(host=self.hostname, database=self.db, port=self.port, user=self.user or None, password=self.password or None)
|
||||
except drda.OperationalError as ex:
|
||||
raise SqlmapConnectionException(getSafeExString(ex))
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ class Connector(GenericConnector):
|
|||
try:
|
||||
database = "DATABASE=%s;HOSTNAME=%s;PORT=%s;PROTOCOL=TCPIP;" % (self.db, self.hostname, self.port)
|
||||
self.connector = ibm_db_dbi.connect(database, self.user, self.password)
|
||||
except ibm_db_dbi.OperationalError as ex:
|
||||
except ibm_db_dbi.Error as ex: # base class: ibm_db_dbi maps wrong-credential (SQLSTATE 28) to ProgrammingError, not OperationalError
|
||||
raise SqlmapConnectionException(getSafeExString(ex))
|
||||
|
||||
self.initCursor()
|
||||
|
|
|
|||
|
|
@ -32,6 +32,14 @@ class Connector(GenericConnector):
|
|||
def connect(self):
|
||||
self.initConnection()
|
||||
|
||||
# Snowflake's mandatory 'account' identifier is carried in the DSN host field
|
||||
# (e.g. -d "snowflake://user:pass@ACCOUNT/db"); warehouse/schema are optional. These were previously
|
||||
# read from self.account/self.warehouse/self.schema which were never set anywhere -> AttributeError on
|
||||
# every attempt.
|
||||
self.account = self.hostname
|
||||
self.warehouse = getattr(self, "warehouse", None)
|
||||
self.schema = getattr(self, "schema", None)
|
||||
|
||||
try:
|
||||
self.connector = snowflake.connector.connect(
|
||||
user=self.user,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue