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

Skip to content

Commit 8e74c57

Browse files
committed
centralization of urlencoding should be (only) in connect.py and we are from now on handling non-urlencoded data at other levels
1 parent 49aeb41 commit 8e74c57

4 files changed

Lines changed: 9 additions & 15 deletions

File tree

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def checkSqlInjection(place, parameter, value):
407407
# Feed with test details every time a test is successful
408408
injection.data[stype] = advancedDict()
409409
injection.data[stype].title = title
410-
injection.data[stype].payload = agent.removePayloadDelimiters(reqPayload, False)
410+
injection.data[stype].payload = agent.removePayloadDelimiters(reqPayload)
411411
injection.data[stype].where = where
412412
injection.data[stype].vector = vector
413413
injection.data[stype].comment = comment

lib/core/agent.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -716,20 +716,14 @@ def addPayloadDelimiters(self, inpStr):
716716

717717
return retVal
718718

719-
def removePayloadDelimiters(self, inpStr, urlencode_=True):
719+
def removePayloadDelimiters(self, inpStr):
720720
"""
721721
Removes payload delimiters from inside the input string
722722
"""
723723
retVal = inpStr
724724

725725
if inpStr:
726-
if urlencode_:
727-
regObj = getCompiledRegex("(?P<result>%s.*?%s)" % (PAYLOAD_DELIMITER, PAYLOAD_DELIMITER))
728-
729-
for match in regObj.finditer(inpStr):
730-
retVal = retVal.replace(match.group("result"), urlencode(match.group("result").strip(PAYLOAD_DELIMITER), convall=True))
731-
else:
732-
retVal = retVal.replace(PAYLOAD_DELIMITER, '')
726+
retVal = retVal.replace(PAYLOAD_DELIMITER, '')
733727

734728
return retVal
735729

lib/request/connect.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -400,25 +400,25 @@ def queryPage(value=None, place=None, content=False, getSeqMatcher=False, silent
400400
logger.log(9, payload)
401401

402402
if place == PLACE.COOKIE and conf.cookieUrlencode:
403-
value = agent.removePayloadDelimiters(value, False)
403+
value = agent.removePayloadDelimiters(value)
404404
value = urlEncodeCookieValues(value)
405405
elif place:
406-
value = agent.removePayloadDelimiters(value, URL_ENCODE_PAYLOAD[place])
406+
value = agent.removePayloadDelimiters(value)
407407

408408
if conf.checkPayload:
409409
checkPayload(value)
410410

411411
if PLACE.GET in conf.parameters:
412-
get = urlencode(conf.parameters[PLACE.GET]) if place != PLACE.GET or not value else value
412+
get = urlencode(conf.parameters[PLACE.GET] if place != PLACE.GET or not value else value)
413413

414414
if PLACE.POST in conf.parameters:
415-
post = urlencode(conf.parameters[PLACE.POST]) if place != PLACE.POST or not value else value
415+
post = urlencode(conf.parameters[PLACE.POST] if place != PLACE.POST or not value else value)
416416

417417
if PLACE.COOKIE in conf.parameters:
418418
cookie = conf.parameters[PLACE.COOKIE] if place != PLACE.COOKIE or not value else value
419419

420420
if PLACE.UA in conf.parameters:
421-
ua = urlencode(conf.parameters[PLACE.UA]) if place != PLACE.UA or not value else value
421+
ua = urlencode(conf.parameters[PLACE.UA] if place != PLACE.UA or not value else value)
422422

423423
if PLACE.URI in conf.parameters:
424424
uri = conf.url if place != PLACE.URI or not value else value

lib/techniques/inband/union/test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,6 @@ def unionTest(comment, place, parameter, value, prefix, suffix):
137137
validPayload, vector = __unionTestByCharBruteforce(comment, place, parameter, value, prefix, suffix)
138138

139139
if validPayload:
140-
validPayload = agent.removePayloadDelimiters(validPayload, False)
140+
validPayload = agent.removePayloadDelimiters(validPayload)
141141

142142
return validPayload, vector

0 commit comments

Comments
 (0)