Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e0f521c

Browse files
committed
minor update regarding --randomize
1 parent ac00014 commit e0f521c

3 files changed

Lines changed: 22 additions & 11 deletions

File tree

lib/core/option.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
from lib.core.settings import BURP_SPLITTER
103103
from lib.core.settings import LOCALHOST
104104
from lib.core.settings import MAX_NUMBER_OF_THREADS
105+
from lib.core.settings import PARAMETER_SPLITTING_REGEX
105106
from lib.core.settings import TIME_DELAY_CANDIDATES
106107
from lib.core.settings import UNKNOWN_DBMS_VERSION
107108
from lib.core.settings import WEBSCARAB_SPLITTER
@@ -778,7 +779,7 @@ def __setTamperingFunctions():
778779
resolve_priorities = False
779780
priorities = []
780781

781-
for tfile in re.split(r'[,|;]', conf.tamper):
782+
for tfile in re.split(PARAMETER_SPLITTING_REGEX, conf.tamper):
782783
found = False
783784

784785
tfile = tfile.strip()
@@ -1276,13 +1277,19 @@ def __cleanupOptions():
12761277
if conf.testParameter:
12771278
conf.testParameter = urldecode(conf.testParameter)
12781279
conf.testParameter = conf.testParameter.replace(" ", "")
1279-
conf.testParameter = conf.testParameter.split(",")
1280+
conf.testParameter = re.split(PARAMETER_SPLITTING_REGEX, conf.testParameter)
12801281
else:
12811282
conf.testParameter = []
12821283

12831284
if conf.user:
12841285
conf.user = conf.user.replace(" ", "")
12851286

1287+
if conf.rParam:
1288+
conf.rParam = conf.rParam.replace(" ", "")
1289+
conf.rParam = re.split(PARAMETER_SPLITTING_REGEX, conf.rParam)
1290+
else:
1291+
conf.rParam = []
1292+
12861293
if conf.delay:
12871294
conf.delay = float(conf.delay)
12881295

lib/core/settings.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,3 +394,6 @@
394394

395395
# Maximum number of times for revalidation of a character in time-based injections
396396
MAX_TIME_REVALIDATION_STEPS = 5
397+
398+
# Characters that can be used to split parameter values in provided command line (e.g. in --tamper)
399+
PARAMETER_SPLITTING_REGEX = r'[,|;]'

lib/request/connect.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -580,15 +580,16 @@ def _randomizeParameter(paramString, randomParameter):
580580
retVal = re.sub("%s=[^&;]+" % randomParameter, "%s=%s" % (randomParameter, randomizeParameterValue(origValue)), paramString)
581581
return retVal
582582

583-
for item in [PLACE.GET, PLACE.POST, PLACE.COOKIE]:
584-
if item in conf.parameters:
585-
origValue = conf.parameters[item]
586-
if item == PLACE.GET and get:
587-
get = _randomizeParameter(get, conf.rParam)
588-
elif item == PLACE.POST and post:
589-
post = _randomizeParameter(post, conf.rParam)
590-
elif item == PLACE.COOKIE and cookie:
591-
cookie = _randomizeParameter(cookie, conf.rParam)
583+
for randomParameter in conf.rParam:
584+
for item in [PLACE.GET, PLACE.POST, PLACE.COOKIE]:
585+
if item in conf.parameters:
586+
origValue = conf.parameters[item]
587+
if item == PLACE.GET and get:
588+
get = _randomizeParameter(get, randomParameter)
589+
elif item == PLACE.POST and post:
590+
post = _randomizeParameter(post, randomParameter)
591+
elif item == PLACE.COOKIE and cookie:
592+
cookie = _randomizeParameter(cookie, randomParameter)
592593

593594
get = urlencode(get, limit=True)
594595
post = urlencode(post)

0 commit comments

Comments
 (0)