mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2024-11-22 09:36:35 +03:00
Refactoring between.py script
This commit is contained in:
parent
f2512d06db
commit
55a9f91bbf
|
@ -38,29 +38,10 @@ def tamper(payload, **kwargs):
|
||||||
retVal = payload
|
retVal = payload
|
||||||
|
|
||||||
if payload:
|
if payload:
|
||||||
retVal = ""
|
match = re.search(r"(?i)(\b(AND|OR)\b\s+)(?!.*\b(AND|OR)\b)([^>]+?)\s*>\s*([^>]+)\s*\Z", payload)
|
||||||
quote, doublequote, firstspace = False, False, False
|
|
||||||
|
|
||||||
for i in xrange(len(payload)):
|
if match:
|
||||||
if not firstspace:
|
_ = "%s %s NOT BETWEEN 0 AND %s" % (match.group(2), match.group(4), match.group(5))
|
||||||
if payload[i].isspace():
|
retVal = retVal.replace(match.group(0), _)
|
||||||
firstspace = True
|
|
||||||
retVal += " "
|
|
||||||
continue
|
|
||||||
|
|
||||||
elif payload[i] == '\'':
|
|
||||||
quote = not quote
|
|
||||||
|
|
||||||
elif payload[i] == '"':
|
|
||||||
doublequote = not doublequote
|
|
||||||
|
|
||||||
elif payload[i] == ">" and not doublequote and not quote:
|
|
||||||
retVal += " " if i > 0 and not payload[i - 1].isspace() else ""
|
|
||||||
retVal += "NOT BETWEEN %s AND" % ('0' if re.search(r"\A[^\w]*\d", payload[i + 1:]) else "NULL")
|
|
||||||
retVal += " " if i < len(payload) - 1 and not payload[i + 1:i + 2].isspace() else ""
|
|
||||||
|
|
||||||
continue
|
|
||||||
|
|
||||||
retVal += payload[i]
|
|
||||||
|
|
||||||
return retVal
|
return retVal
|
||||||
|
|
Loading…
Reference in New Issue
Block a user