mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-03 13:14:13 +03:00
fix for that MSSQL limit/top problem
This commit is contained in:
parent
71d1b72e0e
commit
265e7ca272
|
@ -592,7 +592,7 @@ class Agent:
|
||||||
|
|
||||||
return inbandQuery
|
return inbandQuery
|
||||||
|
|
||||||
def limitQuery(self, num, query, field=None):
|
def limitQuery(self, num, query, field=None, uniqueField=None):
|
||||||
"""
|
"""
|
||||||
Take in input a query string and return its limited query string.
|
Take in input a query string and return its limited query string.
|
||||||
|
|
||||||
|
@ -672,12 +672,12 @@ class Agent:
|
||||||
limitedQuery = limitedQuery.replace("SELECT ", (limitStr % 1), 1)
|
limitedQuery = limitedQuery.replace("SELECT ", (limitStr % 1), 1)
|
||||||
|
|
||||||
if " WHERE " in limitedQuery:
|
if " WHERE " in limitedQuery:
|
||||||
limitedQuery = "%s AND %s " % (limitedQuery, field)
|
limitedQuery = "%s AND %s " % (limitedQuery, field if not uniqueField else uniqueField)
|
||||||
else:
|
else:
|
||||||
limitedQuery = "%s WHERE %s " % (limitedQuery, field)
|
limitedQuery = "%s WHERE %s " % (limitedQuery, field if not uniqueField else uniqueField)
|
||||||
|
|
||||||
limitedQuery += "NOT IN (%s" % (limitStr % num)
|
limitedQuery += "NOT IN (%s" % (limitStr % num)
|
||||||
limitedQuery += "%s %s)" % (field, fromFrom)
|
limitedQuery += "%s %s)" % (field if not uniqueField else uniqueField, fromFrom)
|
||||||
|
|
||||||
if orderBy:
|
if orderBy:
|
||||||
limitedQuery += orderBy
|
limitedQuery += orderBy
|
||||||
|
|
|
@ -81,7 +81,7 @@ def __errorFields(expression, expressionFields, expressionFieldsList, expected=N
|
||||||
|
|
||||||
if isinstance(num, int):
|
if isinstance(num, int):
|
||||||
origExpr = expression
|
origExpr = expression
|
||||||
expression = agent.limitQuery(num, expression, field)
|
expression = agent.limitQuery(num, expression, field, expressionFieldsList[0])
|
||||||
|
|
||||||
if "ROWNUM" in expressionFieldsList:
|
if "ROWNUM" in expressionFieldsList:
|
||||||
expressionReplaced = expression
|
expressionReplaced = expression
|
||||||
|
|
Loading…
Reference in New Issue
Block a user