diff --git a/lib/core/agent.py b/lib/core/agent.py index f9b72b397..56ec22590 100644 --- a/lib/core/agent.py +++ b/lib/core/agent.py @@ -680,10 +680,15 @@ class Agent(object): stopLimit = None limitCond = True - limitRegExp = re.search(queries[Backend.getIdentifiedDbms()].limitregexp.query, expression, re.I) - limitRegExp2 = re.search(queries[Backend.getIdentifiedDbms()].limitregexp.query2, expression, re.I) topLimit = re.search("TOP\s+([\d]+)\s+", expression, re.I) + limitRegExp = re.search(queries[Backend.getIdentifiedDbms()].limitregexp.query, expression, re.I) + + if hasattr(queries[Backend.getIdentifiedDbms()].limitregexp, "query2"): + limitRegExp2 = re.search(queries[Backend.getIdentifiedDbms()].limitregexp.query2, expression, re.I) + else: + limitRegExp2 = None + if (limitRegExp or limitRegExp2) or (Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE) and topLimit): if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.SQLITE): limitGroupStart = queries[Backend.getIdentifiedDbms()].limitgroupstart.query @@ -727,7 +732,10 @@ class Agent(object): # (or equivalent, depending on the back-end DBMS) word if Backend.getIdentifiedDbms() in (DBMS.MYSQL, DBMS.PGSQL, DBMS.SQLITE): stopLimit += startLimit - _ = expression.index(queries[Backend.getIdentifiedDbms()].limitstring.query) + if expression.find(queries[Backend.getIdentifiedDbms()].limitstring.query) > 0: + _ = expression.index(queries[Backend.getIdentifiedDbms()].limitstring.query) + else: + _ = expression.index("LIMIT ") expression = expression[:_] elif Backend.getIdentifiedDbms() in (DBMS.MSSQL, DBMS.SYBASE): diff --git a/lib/core/testing.py b/lib/core/testing.py index 4495edf0e..3937c40d5 100644 --- a/lib/core/testing.py +++ b/lib/core/testing.py @@ -191,6 +191,7 @@ def initCase(switches=None): logger.debug("using output directory '%s' for this test case" % paths.SQLMAP_OUTPUT_PATH) + LOGGER_HANDLER.stream = sys.stdout = StringIO.StringIO() cmdLineOptions = cmdLineParser() cmdLineOptions.liveTest = cmdLineOptions.smokeTest = False @@ -209,11 +210,11 @@ def runCase(switches=None, parse=None): initCase(switches) + LOGGER_HANDLER.stream = sys.stdout = StringIO.StringIO() retVal = True exception = None result = False console = "" - LOGGER_HANDLER.stream = sys.stdout = StringIO.StringIO() try: result = start() diff --git a/xml/livetests.xml b/xml/livetests.xml index 2ffa01e19..8903e35ec 100644 --- a/xml/livetests.xml +++ b/xml/livetests.xml @@ -1,10 +1,13 @@ + + + - + @@ -183,21 +186,13 @@ - - + - - - - - - - @@ -670,4 +665,203 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/xml/payloads.xml b/xml/payloads.xml index 27fb0de3f..6e9155ff2 100644 --- a/xml/payloads.xml +++ b/xml/payloads.xml @@ -717,7 +717,7 @@ Formats: - MySQL boolean-based blind - WHERE or HAVING clause (RLIKE) + MySQL boolean-based blind - WHERE, HAVING, ORDER BY or GROUP BY clause (RLIKE) 1 3 1