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

Skip to content

Commit 939fa5d

Browse files
committed
some fixes
1 parent 9e29120 commit 939fa5d

1 file changed

Lines changed: 18 additions & 5 deletions

File tree

plugins/dbms/access/connector.py

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,30 @@ def __init__(self):
4848
def connect(self):
4949
self.initConnection()
5050

51-
try:
52-
self.connector = pyodbc.connect('DSN=%s' % self.db)
53-
except (pyodbc.Error, pyodbc.OperationalError), msg:
54-
raise sqlmapConnectionException, msg[1]
51+
lastMsg = None
52+
for connString in ('Driver={Microsoft Access Driver (*.mdb)};Dbq=%s;Uid=Admin;Pwd=;' % self.db, 'DSN=%s' % self.db):
53+
try:
54+
self.connector = pyodbc.connect(connString)
55+
break
56+
except pyodbc.Error, msg:
57+
lastMsg = msg
58+
except pyodbc.OperationalError, msg:
59+
raise sqlmapConnectionException, msg[1]
60+
if not self.connector:
61+
raise sqlmapConnectionException, lastMsg[1]
5562

5663
self.setCursor()
5764
self.connected()
5865

5966
def fetchall(self):
6067
try:
61-
return self.cursor.fetchall()
68+
output = self.cursor.fetchall()
69+
for i in xrange(len(output)):
70+
for j in xrange(len(output[i])):
71+
if type(output[i][j]) == str and output[i][j].find('\0') != -1:
72+
output[i][j] = output[i][j][:output[i][j].find('\0')].rstrip()
73+
return output
74+
6275
except pyodbc.ProgrammingError, msg:
6376
logger.log(8, msg[1])
6477
return None

0 commit comments

Comments
 (0)