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

Skip to content

Commit 23cc8b6

Browse files
committed
minor fix for special cases when parameter value contains html encoded characters
1 parent c1ab024 commit 23cc8b6

3 files changed

Lines changed: 8 additions & 2 deletions

File tree

lib/controller/controller.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
from lib.core.common import getPublicTypeMembers
2828
from lib.core.common import getUnicode
2929
from lib.core.common import intersect
30-
from lib.core.common import paramToDict
3130
from lib.core.common import parseTargetUrl
3231
from lib.core.common import randomStr
3332
from lib.core.common import readInput

lib/core/common.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@
106106
from lib.core.settings import DUMP_NEWLINE_MARKER
107107
from lib.core.settings import DUMP_CR_MARKER
108108
from lib.core.settings import DUMP_TAB_MARKER
109+
from lib.core.settings import PARAMETER_AMP_MARKER
110+
from lib.core.settings import PARAMETER_SEMICOLON_MARKER
109111
from lib.core.settings import LARGE_OUTPUT_THRESHOLD
110112
from lib.core.settings import ML
111113
from lib.core.settings import MIN_TIME_RESPONSES
@@ -687,10 +689,11 @@ def paramToDict(place, parameters=None):
687689

688690
if place != PLACE.SOAP:
689691
parameters = parameters.replace(", ", ",")
690-
692+
parameters = re.sub(r"&(\w{1,4});", r"%s\g<1>%s" % (PARAMETER_AMP_MARKER, PARAMETER_SEMICOLON_MARKER), parameters)
691693
splitParams = parameters.split(conf.pDel or (DEFAULT_COOKIE_DELIMITER if place == PLACE.COOKIE else DEFAULT_GET_POST_DELIMITER))
692694

693695
for element in splitParams:
696+
element = re.sub(r"%s(.+?)%s" % (PARAMETER_AMP_MARKER, PARAMETER_SEMICOLON_MARKER), r"&\g<1>;", element)
694697
elem = element.split("=")
695698

696699
if len(elem) >= 2:

lib/core/settings.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@
5252
DUMP_TAB_MARKER = "__TAB__"
5353
DUMP_DEL_MARKER = "__DEL__"
5454

55+
# markers for special cases when parameter values contain html encoded characters
56+
PARAMETER_AMP_MARKER = "__AMP__"
57+
PARAMETER_SEMICOLON_MARKER = "__SEMICOLON__"
58+
5559
URI_QUESTION_MARKER = "__QUESTION_MARK__"
5660

5761
PAYLOAD_DELIMITER = "\x00"

0 commit comments

Comments
 (0)