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

Skip to content

Commit 02bfd05

Browse files
committed
more general approach
1 parent 5443e06 commit 02bfd05

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

lib/core/convert.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
from extra.safe2bin.safe2bin import safecharencode
2525
from extra.safe2bin.safe2bin import safechardecode
2626
from lib.core.data import conf
27+
from lib.core.data import kb
2728
from lib.core.data import logger
2829
from lib.core.enums import PLACE
2930
from lib.core.settings import UNICODE_ENCODING
@@ -89,7 +90,7 @@ def urldecode(value, encoding=None):
8990

9091
return result
9192

92-
def urlencode(value, safe="%&=", convall=False, limit=False, failsafe=True):
93+
def urlencode(value, safe="%&=", convall=False, limit=False):
9394
if conf.direct or PLACE.SOAP in conf.paramDict:
9495
return value
9596

@@ -104,7 +105,8 @@ def urlencode(value, safe="%&=", convall=False, limit=False, failsafe=True):
104105

105106
# corner case when character % really needs to be
106107
# encoded (when not representing url encoded char)
107-
if failsafe and all(map(lambda x: '%' in x, [safe, value])):
108+
# except in cases when tampering scripts are used
109+
if all(map(lambda x: '%' in x, [safe, value])) and not kb.tamperFunctions:
108110
value = re.sub("%(?![0-9a-fA-F]{2})", "%25", value, re.DOTALL | re.IGNORECASE)
109111

110112
while True:

lib/request/connect.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
529529
# throughly without safe chars (especially & and =)
530530
# addendum: as we support url encoding in tampering
531531
# functions therefore we need to use % as a safe char
532-
payload = urlencode(payload, "%", False, True, not kb.tamperFunctions)
532+
payload = urlencode(payload, "%", False, True)
533533
value = agent.replacePayload(value, payload)
534534
elif place == PLACE.SOAP:
535535
# payloads in SOAP should have chars > and < replaced

0 commit comments

Comments
 (0)