From e440b096c5678ac60eecc41f5254a893af712737 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 15 Oct 2012 12:24:30 +0200 Subject: [PATCH] Fix for an Issue #202 --- lib/core/agent.py | 2 +- lib/request/inject.py | 4 +++- plugins/generic/users.py | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib/core/agent.py b/lib/core/agent.py index 34689976d..6f0ec0fa4 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -823,7 +823,7 @@ class Agent: caseExpression = expression - if Backend.getIdentifiedDbms() is not None and hasattr(queries[Backend.getIdentifiedDbms()], "case"): + if Backend.getIdentifiedDbms() is not None: caseExpression = queries[Backend.getIdentifiedDbms()].case.query % expression if "(IIF" not in caseExpression and Backend.getIdentifiedDbms() in FROM_DUMMY_TABLE and not caseExpression.upper().endswith(FROM_DUMMY_TABLE[Backend.getIdentifiedDbms()]): diff --git a/lib/request/inject.py b/lib/request/inject.py index 03830e8b5..8fbfa2672 100644 --- a/lib/request/inject.py +++ b/lib/request/inject.py @@ -379,6 +379,8 @@ def getValue(expression, blind=True, inband=True, error=True, time=True, fromUse if expression.upper().startswith("SELECT "): booleanExpression = expression[len("SELECT "):] + if re.search(r"(?i)\(.+\)\Z", booleanExpression): + booleanExpression = "%s=%s" % (booleanExpression, "'1'" if "'1'" in booleanExpression else '1') else: forgeCaseExpression = agent.forgeCaseStatement(expression) @@ -472,4 +474,4 @@ def goStacked(expression, silent=False): Request.queryPage(payload, content=False, silent=silent, noteResponseTime=False, timeBasedCompare=True) def checkBooleanExpression(expression, expectingNone=True): - return getValue(unescaper.unescape(expression), expected=EXPECTED.BOOL, charsetType=CHARSET_TYPE.BINARY, suppressOutput=True, expectingNone=expectingNone) + return getValue(expression, expected=EXPECTED.BOOL, charsetType=CHARSET_TYPE.BINARY, suppressOutput=True, expectingNone=expectingNone) diff --git a/plugins/generic/users.py b/plugins/generic/users.py index c3ab4f520..1df358b41 100644 --- a/plugins/generic/users.py +++ b/plugins/generic/users.py @@ -78,7 +78,7 @@ class Users: query = queries[Backend.getIdentifiedDbms()].is_dba.query query = agent.forgeCaseStatement(query) - kb.data.isDba = unArrayizeValue(inject.getValue(query, expected=EXPECTED.BOOL, charsetType=CHARSET_TYPE.BINARY)) + kb.data.isDba = inject.checkBooleanExpression(query) return kb.data.isDba