mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-26 03:23:48 +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()
|
|
||||||
|
if self.execute(query):
|
||||||
|
retVal = self.fetchall()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.connector.commit()
|
self.connector.commit()
|
||||||
except pymssql.OperationalError:
|
except pymssql.OperationalError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return value
|
return retVal
|
||||||
|
|
Loading…
Reference in New Issue
Block a user