From 88d74a00c10325c54bba225ea7d4d207328946f2 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 30 Mar 2010 12:48:51 +0000 Subject: [PATCH] ms access connector update --- plugins/dbms/access/connector.py | 12 ++++++++---- plugins/dbms/access/fingerprint.py | 4 +++- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/plugins/dbms/access/connector.py b/plugins/dbms/access/connector.py index a3e55a604..b2d5831b8 100644 --- a/plugins/dbms/access/connector.py +++ b/plugins/dbms/access/connector.py @@ -68,7 +68,7 @@ class Connector(GenericConnector): try: self.cursor.execute(query) - except pyodbc.OperationalError, msg: + except (pyodbc.OperationalError, pyodbc.ProgrammingError), msg: logger.log(8, msg[1]) except pyodbc.Error, msg: raise sqlmapConnectionException, msg[1] @@ -76,9 +76,13 @@ class Connector(GenericConnector): self.connector.commit() def select(self, query): - self.cursor.execute(query) - return self.cursor.fetchall() - + try: + self.cursor.execute(query) + return self.cursor.fetchall() + except pyodbc.ProgrammingError, msg: + logger.log(8, msg[1]) + return None + def setCursor(self): self.cursor = self.connector.cursor() diff --git a/plugins/dbms/access/fingerprint.py b/plugins/dbms/access/fingerprint.py index ddedbbf82..417bf79bf 100644 --- a/plugins/dbms/access/fingerprint.py +++ b/plugins/dbms/access/fingerprint.py @@ -82,10 +82,12 @@ class Fingerprint(GenericFingerprint): negate = True table = table[1:] randInt = randomInt() - query = agent.prefixQuery(" AND EXISTS(SELECT * FROM %s WHERE %d=%d)" % (table, randInt, randInt)) + query = agent.prefixQuery(" AND EXISTS(SELECT * FROM %s WHERE %d=%d) FROM %s" % (table, randInt, randInt, table)) query = agent.postfixQuery(query) payload = agent.payload(newValue=query) result = Request.queryPage(payload) + if result is None: + result = False if negate: result = not result exist &= result