3535from lib .core .exception import SqlmapMissingDependence
3636from plugins .generic .connector import Connector as GenericConnector
3737
38+ def getSafeExString (ex , encoding = None ): # Cross-referenced function
39+ raise NotImplementedError
40+
3841class SQLAlchemy (GenericConnector ):
3942 def __init__ (self , dialect = None ):
4043 GenericConnector .__init__ (self )
@@ -77,7 +80,7 @@ def connect(self):
7780 except SqlmapFilePathException :
7881 raise
7982 except Exception as ex :
80- raise SqlmapConnectionException ("SQLAlchemy connection issue ('%s')" % ex . msg )
83+ raise SqlmapConnectionException ("SQLAlchemy connection issue ('%s')" % getSafeExString ( ex ) )
8184
8285 self .printConnected ()
8386 else :
@@ -90,16 +93,16 @@ def fetchall(self):
9093 retVal .append (tuple (row ))
9194 return retVal
9295 except _sqlalchemy .exc .ProgrammingError as ex :
93- logger .log (logging .WARN if conf .dbmsHandler else logging .DEBUG , "(remote) %s" % ex . message if hasattr (ex , "message" ) else ex )
96+ logger .log (logging .WARN if conf .dbmsHandler else logging .DEBUG , "(remote) %s" % getSafeExString (ex ) )
9497 return None
9598
9699 def execute (self , query ):
97100 try :
98101 self .cursor = self .connector .execute (query )
99102 except (_sqlalchemy .exc .OperationalError , _sqlalchemy .exc .ProgrammingError ) as ex :
100- logger .log (logging .WARN if conf .dbmsHandler else logging .DEBUG , "(remote) %s" % ex . message if hasattr (ex , "message" ) else ex )
103+ logger .log (logging .WARN if conf .dbmsHandler else logging .DEBUG , "(remote) %s" % getSafeExString (ex ) )
101104 except _sqlalchemy .exc .InternalError as ex :
102- raise SqlmapConnectionException (ex [ 1 ] )
105+ raise SqlmapConnectionException (getSafeExString ( ex ) )
103106
104107 def select (self , query ):
105108 self .execute (query )
0 commit comments