mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
Added support to directly connect also to SQLite 2 db file
This commit is contained in:
parent
fee062781f
commit
1ab78ce60e
|
@ -643,7 +643,7 @@ def parseTargetDirect():
|
||||||
"MySQL": [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
|
"MySQL": [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
|
||||||
"PostgreSQL": [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
|
"PostgreSQL": [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
|
||||||
"Oracle": [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
|
"Oracle": [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
|
||||||
"SQLite": [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
|
"SQLite": [SQLITE_ALIASES, "python-pysqlite2 and python-sqlite", "http://pysqlite.googlecode.com/"],
|
||||||
"Access": [ACCESS_ALIASES, "python-pyodbc", "http://pyodbc.googlecode.com/"],
|
"Access": [ACCESS_ALIASES, "python-pyodbc", "http://pyodbc.googlecode.com/"],
|
||||||
"Firebird": [FIREBIRD_ALIASES, "python-kinterbasdb", "http://kinterbasdb.sourceforge.net/"] }
|
"Firebird": [FIREBIRD_ALIASES, "python-kinterbasdb", "http://kinterbasdb.sourceforge.net/"] }
|
||||||
|
|
||||||
|
@ -679,6 +679,7 @@ def parseTargetDirect():
|
||||||
elif dbmsName == "Oracle":
|
elif dbmsName == "Oracle":
|
||||||
import cx_Oracle
|
import cx_Oracle
|
||||||
elif dbmsName == "SQLite":
|
elif dbmsName == "SQLite":
|
||||||
|
import sqlite
|
||||||
import sqlite3
|
import sqlite3
|
||||||
elif dbmsName == "Access":
|
elif dbmsName == "Access":
|
||||||
import pyodbc
|
import pyodbc
|
||||||
|
|
|
@ -23,6 +23,7 @@ Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||||
"""
|
"""
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
import sqlite
|
||||||
import sqlite3
|
import sqlite3
|
||||||
except ImportError, _:
|
except ImportError, _:
|
||||||
pass
|
pass
|
||||||
|
@ -52,9 +53,15 @@ class Connector(GenericConnector):
|
||||||
self.checkFileDb()
|
self.checkFileDb()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.connector = sqlite3.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
|
self.connector = sqlite.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
|
||||||
except sqlite3.OperationalError, msg:
|
except (sqlite.DatabaseError, sqlite.OperationalError), _:
|
||||||
raise sqlmapConnectionException, msg[0]
|
errMsg = "unable to connect using SQLite 2 library, trying with SQLite 3"
|
||||||
|
logger.error(errMsg)
|
||||||
|
|
||||||
|
try:
|
||||||
|
self.connector = sqlite3.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
|
||||||
|
except (sqlite.DatabaseError, sqlite.OperationalError), msg:
|
||||||
|
raise sqlmapConnectionException, msg[0]
|
||||||
|
|
||||||
self.setCursor()
|
self.setCursor()
|
||||||
self.connected()
|
self.connected()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user