Patch for an Issue #212

This commit is contained in:
Miroslav Stampar 2012-10-23 15:34:59 +02:00
parent eb6f17b561
commit 6e2fce66aa
8 changed files with 34 additions and 16 deletions

View File

@ -10,6 +10,9 @@ try:
except ImportError, _:
pass
import logging
from lib.core.data import conf
from lib.core.data import logger
from lib.core.exception import sqlmapConnectionException
from lib.core.exception import sqlmapUnsupportedFeatureException
@ -49,14 +52,14 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except pyodbc.ProgrammingError, msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
return None
def execute(self, query):
try:
self.cursor.execute(query)
except (pyodbc.OperationalError, pyodbc.ProgrammingError), msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
except pyodbc.Error, msg:
raise sqlmapConnectionException, msg[1]

View File

@ -10,6 +10,9 @@ try:
except ImportError, _:
pass
import logging
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
@ -42,14 +45,14 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except ibm_db_dbi.ProgrammingError, msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
return None
def execute(self, query):
try:
self.cursor.execute(query)
except (ibm_db_dbi.OperationalError, ibm_db_dbi.ProgrammingError), msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
except ibm_db_dbi.InternalError, msg:
raise sqlmapConnectionException, msg[1]

View File

@ -10,6 +10,8 @@ try:
except ImportError, _:
pass
import logging
from lib.core.data import logger
from lib.core.exception import sqlmapConnectionException
from lib.core.settings import UNICODE_ENCODING
@ -47,14 +49,14 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except kinterbasdb.OperationalError, msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
return None
def execute(self, query):
try:
self.cursor.execute(query)
except kinterbasdb.OperationalError, msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
except kinterbasdb.Error, msg:
raise sqlmapConnectionException, msg[1]

View File

@ -11,6 +11,8 @@ try:
except ImportError, _:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@ -49,7 +51,7 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg:
logger.warn("(remote) %s" % str(msg).replace("\n", " "))
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
return None
def execute(self, query):
@ -59,7 +61,7 @@ class Connector(GenericConnector):
self.cursor.execute(utf8encode(query))
retVal = True
except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
logger.warn("(remote) %s" % str(msg).replace("\n", " "))
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
except pymssql.InternalError, msg:
raise sqlmapConnectionException, msg

View File

@ -10,6 +10,8 @@ try:
except ImportError, _:
pass
import logging
from lib.core.data import conf
from lib.core.data import logger
from lib.core.exception import sqlmapConnectionException
@ -44,7 +46,7 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except pymysql.ProgrammingError, msg:
logger.warn(msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
return None
def execute(self, query):
@ -54,7 +56,7 @@ class Connector(GenericConnector):
self.cursor.execute(query)
retVal = True
except (pymysql.OperationalError, pymysql.ProgrammingError), msg:
logger.warn("(remote) %s" % msg[1])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1])
except pymysql.InternalError, msg:
raise sqlmapConnectionException, msg[1]

View File

@ -10,9 +10,11 @@ try:
except ImportError, _:
pass
import logging
import os
from lib.core.convert import utf8encode
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
@ -53,7 +55,7 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except cx_Oracle.InterfaceError, msg:
logger.warn("(remote) %s" % msg)
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
return None
def execute(self, query):
@ -63,7 +65,7 @@ class Connector(GenericConnector):
self.cursor.execute(utf8encode(query))
retVal = True
except (cx_Oracle.DatabaseError), msg:
logger.warn("(remote) %s" % msg)
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
except cx_Oracle.InternalError, msg:
raise sqlmapConnectionException, msg

View File

@ -10,6 +10,8 @@ try:
except ImportError, _:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@ -68,14 +70,14 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except self.__sqlite.OperationalError, msg:
logger.warn("(remote) %s" % msg[0])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[0])
return None
def execute(self, query):
try:
self.cursor.execute(utf8encode(query))
except self.__sqlite.OperationalError, msg:
logger.warn("(remote) %s" % msg[0])
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[0])
except self.__sqlite.DatabaseError, msg:
raise sqlmapConnectionException, msg[0]

View File

@ -11,6 +11,8 @@ try:
except ImportError, _:
pass
import logging
from lib.core.convert import utf8encode
from lib.core.data import conf
from lib.core.data import logger
@ -49,14 +51,14 @@ class Connector(GenericConnector):
try:
return self.cursor.fetchall()
except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg:
logger.warn("(remote) %s" % msg)
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
return None
def execute(self, query):
try:
self.cursor.execute(utf8encode(query))
except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
logger.warn("(remote) %s" % msg)
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
except pymssql.InternalError, msg:
raise sqlmapConnectionException, msg