Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e810fe7

Browse files
committed
no need for obsolete (and hard to find) sqlite module when sqlite3 handles both database versions
1 parent 27496b9 commit e810fe7

2 files changed

Lines changed: 4 additions & 12 deletions

File tree

lib/core/common.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,7 @@ def parseTargetDirect():
684684
"MySQL": [MYSQL_ALIASES, "python-mysqldb", "http://mysql-python.sourceforge.net/"],
685685
"PostgreSQL": [PGSQL_ALIASES, "python-psycopg2", "http://initd.org/psycopg/"],
686686
"Oracle": [ORACLE_ALIASES, "python cx_Oracle", "http://cx-oracle.sourceforge.net/"],
687-
"SQLite": [SQLITE_ALIASES, "python-pysqlite2 and python-sqlite", "http://pysqlite.googlecode.com/"],
687+
"SQLite": [SQLITE_ALIASES, "python-pysqlite2", "http://pysqlite.googlecode.com/"],
688688
"Access": [ACCESS_ALIASES, "python-pyodbc", "http://pyodbc.googlecode.com/"],
689689
"Firebird": [FIREBIRD_ALIASES, "python-kinterbasdb", "http://kinterbasdb.sourceforge.net/"] }
690690

@@ -720,7 +720,6 @@ def parseTargetDirect():
720720
elif dbmsName == "Oracle":
721721
import cx_Oracle
722722
elif dbmsName == "SQLite":
723-
import sqlite
724723
import sqlite3
725724
elif dbmsName == "Access":
726725
import pyodbc

plugins/dbms/sqlite/connector.py

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"""
2424

2525
try:
26-
import sqlite
2726
import sqlite3
2827
except ImportError, _:
2928
pass
@@ -54,15 +53,9 @@ def connect(self):
5453
self.checkFileDb()
5554

5655
try:
57-
self.connector = sqlite.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
58-
except (sqlite.DatabaseError, sqlite.OperationalError), _:
59-
errMsg = "unable to connect using SQLite 2 library, trying with SQLite 3"
60-
logger.error(errMsg)
61-
62-
try:
63-
self.connector = sqlite3.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
64-
except (sqlite.DatabaseError, sqlite.OperationalError), msg:
65-
raise sqlmapConnectionException, msg[0]
56+
self.connector = sqlite3.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
57+
except (sqlite3.DatabaseError, sqlite3.OperationalError), msg:
58+
raise sqlmapConnectionException, msg[0]
6659

6760
self.setCursor()
6861
self.connected()

0 commit comments

Comments
 (0)