Minor fix of space2 tamper scripts

This commit is contained in:
Miroslav Štampar 2026-06-04 20:00:38 +02:00
parent f564db0d56
commit 2c356ed22a
7 changed files with 85 additions and 35 deletions

View file

@ -42,13 +42,23 @@ def tamper(payload, **kwargs):
retVal = ""
if payload:
quote, doublequote = False, False
for i in xrange(len(payload)):
if payload[i].isspace():
randomStr = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase) for _ in xrange(random.randint(6, 12)))
retVal += "%%23%s%%0A" % randomStr
elif payload[i] == '#' or payload[i:i + 3] == '-- ':
retVal += payload[i:]
break
if payload[i] == '\'' and (i == 0 or payload[i - 1] != '\\'):
quote = not quote
elif payload[i] == '"' and (i == 0 or payload[i - 1] != '\\'):
doublequote = not doublequote
if not quote and not doublequote:
if payload[i].isspace():
randomStr = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase) for _ in xrange(random.randint(6, 12)))
retVal += "%%23%s%%0A" % randomStr
elif payload[i] == '#' or payload[i:i + 3] == '-- ':
retVal += payload[i:]
break
else:
retVal += payload[i]
else:
retVal += payload[i]