MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / connect

Method connect

plugins/dbms/sqlite/connector.py:38–67  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

36 self.__sqlite = sqlite3
37
38 def connect(self):
39 self.initConnection()
40 self.checkFileDb()
41
42 try:
43 self.connector = self.__sqlite.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
44
45 cursor = self.connector.cursor()
46 cursor.execute("SELECT * FROM sqlite_master")
47 cursor.close()
48
49 except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError):
50 warnMsg = "unable to connect using SQLite 3 library, trying with SQLite 2"
51 logger.warning(warnMsg)
52
53 try:
54 try:
55 import sqlite
56 except ImportError:
57 errMsg = "sqlmap requires 'python-sqlite' third-party library "
58 errMsg += "in order to directly connect to the database '%s'" % self.db
59 raise SqlmapMissingDependence(errMsg)
60
61 self.__sqlite = sqlite
62 self.connector = self.__sqlite.connect(database=self.db, check_same_thread=False, timeout=conf.timeout)
63 except (self.__sqlite.DatabaseError, self.__sqlite.OperationalError) as ex:
64 raise SqlmapConnectionException(getSafeExString(ex))
65
66 self.initCursor()
67 self.printConnected()
68
69 def fetchall(self):
70 try:

Callers

nothing calls this directly

Calls 9

initConnectionMethod · 0.95
checkFileDbMethod · 0.95
initCursorMethod · 0.95
printConnectedMethod · 0.95
getSafeExStringFunction · 0.90
executeMethod · 0.45
closeMethod · 0.45

Tested by

no test coverage detected