Skip to content

Commit c394610

Browse files
committed
adding switch --skip-urlencode to skip URL encoding of POST data
1 parent 7657bbe commit c394610

4 files changed

Lines changed: 12 additions & 3 deletions

File tree

lib/core/optiondict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"scope": "string",
4949
"safUrl": "string",
5050
"saFreq": "integer",
51+
"skipUrlEncode": "boolean",
5152
"evalCode": "string"
5253
},
5354

lib/parse/cmdline.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,10 @@ def cmdLineParser():
149149
request.add_option("--safe-freq", dest="saFreq", type="int",
150150
help="Test requests between two visits to a given safe url")
151151

152+
request.add_option("--skip-urlencode", dest="skipUrlEncode",
153+
action="store_true",
154+
help="Skip URL encoding of POST data")
155+
152156
request.add_option("--eval", dest="evalCode",
153157
help="Evaluate provided Python code before the request (e.g. \"import hashlib;id2=hashlib.md5(id).hexdigest()\")")
154158

lib/request/connect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,7 +559,7 @@ def queryPage(value=None, place=None, content=False, getRatioValue=False, silent
559559
# addendum: as we support url encoding in tampering
560560
# functions therefore we need to use % as a safe char
561561
if place != PLACE.URI or (value and payload and '?' in value and value.find('?') < value.find(payload)):
562-
payload = urlencode(payload, '%', False, True)
562+
payload = urlencode(payload, '%', False, True) if not place == PLACE.POST and conf.skipUrlEncode else payload
563563
value = agent.replacePayload(value, payload)
564564

565565
elif place == PLACE.SOAP:
@@ -653,9 +653,9 @@ def _randomizeParameter(paramString, randomParameter):
653653
get += "%s%s=%s" % (delimiter, name, value)
654654

655655
get = urlencode(get, limit=True)
656-
if post and place != PLACE.POST and hasattr(post, UNENCODED_ORIGINAL_VALUE):
656+
if post and place not in (PLACE.POST, PLACE.SOAP) and hasattr(post, UNENCODED_ORIGINAL_VALUE):
657657
post = getattr(post, UNENCODED_ORIGINAL_VALUE)
658-
else:
658+
elif not conf.skipUrlEncode and place not in (PLACE.SOAP,):
659659
post = urlencode(post)
660660

661661
if timeBasedCompare:

sqlmap.conf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ safUrl =
138138
# Default: 0
139139
saFreq = 0
140140

141+
# Skip URL encoding of POST data
142+
# Valid: True or False
143+
skipUrlEncode = False
144+
141145
# Evaluate provided Python code before the request.
142146
# Example: import hashlib;id2=hashlib.md5(id).hexdigest()
143147
evalCode =

0 commit comments

Comments
 (0)