introducing new style for copyright header

This commit is contained in:
Miroslav Stampar
2010-10-14 14:02:43 +00:00
parent f07608ef4d
commit d970e260b9
7 changed files with 44 additions and 1 deletions

View File

@@ -1,3 +1,6 @@
# Copyright (c) 2006-2010 sqlmap project (http://sqlmap.sourceforge.net/)
# See the file doc/COPYING for copying permission.
import re
from lib.core.convert import urldecode
@@ -7,14 +10,16 @@ from lib.core.convert import urlencode
IFNULL(A,B) -> IF(ISNULL(A),B,A) (e.g., IFNULL(1,2) -> IF(ISNULL(1),2,1))
"""
def tamper(place, value):
if value and value.find("IFNULL") > -1:
if place != "URI":
value = urldecode(value)
#value = re.sub(r"IFNULL\(\({%d}(?P<A>.+?)\){%d},(?P<B>.+?)\)" % (num, num), lambda match: "IF(ISNULL(%s),%s,%s)" % (match.group("A"), match.group("B"), match.group("A")), value)
while value.find("IFNULL(") > -1:
index = value.find("IFNULL(")
deepness = 1
comma, end = None, None
for i in xrange(index + len("IFNULL("), len(value)):
if deepness == 1 and value[i] == ',':
comma = i
@@ -25,6 +30,7 @@ def tamper(place, value):
deepness += 1
elif value[i] == ')':
deepness -= 1
if comma and end:
A = value[index + len("IFNULL("):comma]
B = value[comma + 1:end]
@@ -32,6 +38,8 @@ def tamper(place, value):
value = value[:index] + newVal + value[end+1:]
else:
break
if place != "URI":
value = urlencode(value)
return value