Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cad8f61

Browse files
committed
Force pymssql to version >= 1.0.2
1 parent b19de01 commit cad8f61

2 files changed

Lines changed: 15 additions & 1 deletion

File tree

lib/core/common.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -651,6 +651,13 @@ def parseTargetDirect():
651651
if dbmsName == "Microsoft SQL Server":
652652
import _mssql
653653
import pymssql
654+
655+
if not hasattr(pymssql, "__version__") or pymssql.__version__ < "1.0.2":
656+
errMsg = "pymssql library on your system must be "
657+
errMsg += "version 1.0.2 to work, get it from "
658+
errMsg += "http://sourceforge.net/projects/pymssql/files/pymssql/1.0.2/"
659+
raise sqlmapMissingDependence, errMsg
660+
654661
elif dbmsName == "MySQL":
655662
import MySQLdb
656663
elif dbmsName == "PostgreSQL":

plugins/dbms/mssqlserver/connector.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,9 @@ class Connector(GenericConnector):
4343
License: LGPL
4444
4545
Possible connectors: http://wiki.python.org/moin/SQL%20Server
46+
47+
Important note: pymssql library on your system MUST be version 1.0.2
48+
to work, get it from http://sourceforge.net/projects/pymssql/files/pymssql/1.0.2/
4649
"""
4750

4851
def __init__(self):
@@ -79,6 +82,10 @@ def execute(self, query):
7982
def select(self, query):
8083
self.execute(query)
8184
value = self.fetchall()
82-
self.connector.commit()
85+
86+
try:
87+
self.connector.commit()
88+
except pymssql.OperationalError:
89+
pass
8390

8491
return value

0 commit comments

Comments
 (0)