From 1c47b330203520050ec8c33971ed28d863f94f8b Mon Sep 17 00:00:00 2001 From: stamparm Date: Mon, 15 Apr 2013 15:23:45 +0200 Subject: [PATCH] Few bug fixes in -d (there were late values in payloads in some cases; sqlalchemy returns RowProxy for tuple) --- lib/core/agent.py | 2 ++ lib/utils/sqlalchemy.py | 5 ++++- plugins/dbms/mysql/fingerprint.py | 1 - 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index 69f27f485..b46749810 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -42,6 +42,8 @@ class Agent(object): """ def payloadDirect(self, query): + query = self.cleanupPayload(query) + if query.startswith("AND "): query = query.replace("AND ", "SELECT ", 1) elif query.startswith(" UNION ALL "): diff --git a/lib/utils/sqlalchemy.py b/lib/utils/sqlalchemy.py index 3d6ae0c2a..fd176e8b0 100644 --- a/lib/utils/sqlalchemy.py +++ b/lib/utils/sqlalchemy.py @@ -45,7 +45,10 @@ class SQLAlchemy(GenericConnector): def fetchall(self): try: - return self.cursor.fetchall() + retVal = [] + for row in self.cursor.fetchall(): + retVal.append(tuple(row)) + return retVal except _sqlalchemy.exc.ProgrammingError, msg: logger.log(logging.WARN if conf.dbmsHandler else logging.DEBUG, "(remote) %s" % msg[1]) return None diff --git a/plugins/dbms/mysql/fingerprint.py b/plugins/dbms/mysql/fingerprint.py index a02076cfc..ca9672f00 100644 --- a/plugins/dbms/mysql/fingerprint.py +++ b/plugins/dbms/mysql/fingerprint.py @@ -224,7 +224,6 @@ class Fingerprint(GenericFingerprint): else: Backend.setVersionList([">= 5.0.0", "< 5.0.3"]) - # For cases when information_schema is missing elif inject.checkBooleanExpression("DATABASE() LIKE SCHEMA()"): Backend.setVersion(">= 5.0.2") setDbms("%s 5" % DBMS.MYSQL)