From e73ac6c8e309a6957a4414b5326765b4dd0681c4 Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Sat, 17 Jan 2015 21:47:57 +0100 Subject: [PATCH] Minor patch on request of an user --- lib/core/common.py | 2 ++ lib/request/connect.py | 10 ++++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 972f09334..872b949fd 100755 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -3360,6 +3360,8 @@ def randomizeParameterValue(value): retVal = value + value = re.sub(r"%[0-9a-fA-F]{2}", "", value) + for match in re.finditer('[A-Z]+', value): retVal = retVal.replace(match.group(), randomStr(len(match.group())).upper()) diff --git a/lib/request/connect.py b/lib/request/connect.py index 808bd0222..6779707e7 100644 --- a/lib/request/connect.py +++ b/lib/request/connect.py @@ -818,21 +818,23 @@ class Connect(object): if conf.rParam: def _randomizeParameter(paramString, randomParameter): retVal = paramString - match = re.search("%s=(?P[^&;]+)" % re.escape(randomParameter), paramString) + match = re.search(r"(\A|\b)%s=(?P[^&;]+)" % re.escape(randomParameter), paramString) if match: 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 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 == PLACE.GET and get: get = _randomizeParameter(get, randomParameter) - elif item == PLACE.POST and post: + elif item in (PLACE.POST, PLACE.CUSTOM_POST) and post: post = _randomizeParameter(post, randomParameter) elif item == PLACE.COOKIE and cookie: cookie = _randomizeParameter(cookie, randomParameter) + elif item == PLACE.URI and uri: + uri = _randomizeParameter(uri, randomParameter) if conf.evalCode: delimiter = conf.paramDel or DEFAULT_GET_POST_DELIMITER