Minor patch on request of an user

This commit is contained in:
Miroslav Stampar 2015-01-17 21:47:57 +01:00
parent c2b2ccd2b5
commit e73ac6c8e3
2 changed files with 8 additions and 4 deletions

View File

@ -3360,6 +3360,8 @@ def randomizeParameterValue(value):
retVal = value retVal = value
value = re.sub(r"%[0-9a-fA-F]{2}", "", value)
for match in re.finditer('[A-Z]+', value): for match in re.finditer('[A-Z]+', value):
retVal = retVal.replace(match.group(), randomStr(len(match.group())).upper()) retVal = retVal.replace(match.group(), randomStr(len(match.group())).upper())

View File

@ -818,21 +818,23 @@ class Connect(object):
if conf.rParam: if conf.rParam:
def _randomizeParameter(paramString, randomParameter): def _randomizeParameter(paramString, randomParameter):
retVal = paramString retVal = paramString
match = re.search("%s=(?P<value>[^&;]+)" % re.escape(randomParameter), paramString) match = re.search(r"(\A|\b)%s=(?P<value>[^&;]+)" % re.escape(randomParameter), paramString)
if match: if match:
origValue = match.group("value") origValue = match.group("value")
retVal = re.sub("%s=[^&;]+" % re.escape(randomParameter), "%s=%s" % (randomParameter, randomizeParameterValue(origValue)), paramString) retVal = re.sub(r"(\A|\b)%s=[^&;]+" % re.escape(randomParameter), "%s=%s" % (randomParameter, randomizeParameterValue(origValue)), paramString)
return retVal return retVal
for randomParameter in conf.rParam: for randomParameter in conf.rParam:
for item in (PLACE.GET, PLACE.POST, PLACE.COOKIE): for item in (PLACE.GET, PLACE.POST, PLACE.COOKIE, PLACE.URI, PLACE.CUSTOM_POST):
if item in conf.parameters: if item in conf.parameters:
if item == PLACE.GET and get: if item == PLACE.GET and get:
get = _randomizeParameter(get, randomParameter) get = _randomizeParameter(get, randomParameter)
elif item == PLACE.POST and post: elif item in (PLACE.POST, PLACE.CUSTOM_POST) and post:
post = _randomizeParameter(post, randomParameter) post = _randomizeParameter(post, randomParameter)
elif item == PLACE.COOKIE and cookie: elif item == PLACE.COOKIE and cookie:
cookie = _randomizeParameter(cookie, randomParameter) cookie = _randomizeParameter(cookie, randomParameter)
elif item == PLACE.URI and uri:
uri = _randomizeParameter(uri, randomParameter)
if conf.evalCode: if conf.evalCode:
delimiter = conf.paramDel or DEFAULT_GET_POST_DELIMITER delimiter = conf.paramDel or DEFAULT_GET_POST_DELIMITER