minor cosmetics on tamper scripts

This commit is contained in:
Miroslav Stampar
2011-04-04 08:18:26 +00:00
parent 33d987805d
commit 3253882071
9 changed files with 75 additions and 76 deletions

View File

@@ -11,39 +11,39 @@ from lib.core.enums import PRIORITY
__priority__ = PRIORITY.HIGHEST
def tamper(value):
def tamper(payload):
"""
Replaces '>' with 'NOT BETWEEN 0 AND #'
Example: 'A > B' becomes 'A NOT BETWEEN 0 AND B'
"""
retVal = value
retVal = payload
if value:
if payload:
retVal = ""
quote, doublequote, firstspace = False, False, False
for i in xrange(len(value)):
for i in xrange(len(payload)):
if not firstspace:
if value[i].isspace():
if payload[i].isspace():
firstspace = True
retVal += " "
continue
elif value[i] == '\'':
elif payload[i] == '\'':
quote = not quote
elif value[i] == '"':
elif payload[i] == '"':
doublequote = not doublequote
elif value[i] == ">" and not doublequote and not quote:
retVal += " " if i > 0 and not value[i-1].isspace() else ""
elif payload[i] == ">" and not doublequote and not quote:
retVal += " " if i > 0 and not payload[i-1].isspace() else ""
retVal += "NOT BETWEEN 0 AND"
retVal += " " if i < len(value) - 1 and not value[i+1].isspace() else ""
retVal += " " if i < len(payload) - 1 and not payload[i+1].isspace() else ""
continue
retVal += value[i]
retVal += payload[i]
return retVal