mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
align to MSSQL connector
This commit is contained in:
parent
ca337159f5
commit
2a2d7e886d
|
@ -51,24 +51,31 @@ class Connector(GenericConnector):
|
||||||
try:
|
try:
|
||||||
return self.cursor.fetchall()
|
return self.cursor.fetchall()
|
||||||
except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg:
|
except (pymssql.ProgrammingError, pymssql.OperationalError, _mssql.MssqlDatabaseException), msg:
|
||||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
|
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def execute(self, query):
|
def execute(self, query):
|
||||||
|
retVal = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.cursor.execute(utf8encode(query))
|
self.cursor.execute(utf8encode(query))
|
||||||
|
retVal = True
|
||||||
except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
|
except (pymssql.OperationalError, pymssql.ProgrammingError), msg:
|
||||||
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg)
|
logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % str(msg).replace("\n", " "))
|
||||||
except pymssql.InternalError, msg:
|
except pymssql.InternalError, msg:
|
||||||
raise SqlmapConnectionException(msg)
|
raise SqlmapConnectionException(msg)
|
||||||
|
|
||||||
|
return retVal
|
||||||
|
|
||||||
def select(self, query):
|
def select(self, query):
|
||||||
self.execute(query)
|
retVal = None
|
||||||
value = self.fetchall()
|
|
||||||
|
|
||||||
try:
|
if self.execute(query):
|
||||||
self.connector.commit()
|
retVal = self.fetchall()
|
||||||
except pymssql.OperationalError:
|
|
||||||
pass
|
|
||||||
|
|
||||||
return value
|
try:
|
||||||
|
self.connector.commit()
|
||||||
|
except pymssql.OperationalError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
return retVal
|
||||||
|
|
Loading…
Reference in New Issue
Block a user