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

Skip to content

Commit d886b08

Browse files
committed
Update for an Issue #1826
1 parent 72f3185 commit d886b08

3 files changed

Lines changed: 40 additions & 2 deletions

File tree

lib/core/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def payload(self, place=None, parameter=None, value=None, newValue=None, where=N
168168
retVal = retVal.replace(CUSTOM_INJECTION_MARK_CHAR, "").replace(REPLACEMENT_MARKER, CUSTOM_INJECTION_MARK_CHAR)
169169
elif BOUNDED_INJECTION_MARKER in paramDict[parameter]:
170170
_ = "%s%s" % (origValue, BOUNDED_INJECTION_MARKER)
171-
retVal = "%s=%s" % (parameter, paramString.replace(_, self.addPayloadDelimiters(newValue)))
171+
retVal = "%s=%s" % (re.sub(r" \#\d\*\Z", "", parameter), paramString.replace(_, self.addPayloadDelimiters(newValue)))
172172
elif place in (PLACE.USER_AGENT, PLACE.REFERER, PLACE.HOST):
173173
retVal = paramString.replace(origValue, self.addPayloadDelimiters(newValue))
174174
else:

lib/core/common.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -604,6 +604,44 @@ def paramToDict(place, parameters=None):
604604
for regex in (r"\A((?:<[^>]+>)+\w+)((?:<[^>]+>)+)\Z", r"\A([^\w]+.*\w+)([^\w]+)\Z"):
605605
match = re.search(regex, testableParameters[parameter])
606606
if match:
607+
try:
608+
candidates = OrderedDict()
609+
610+
def walk(head, current=None):
611+
current = current or head
612+
if isListLike(current):
613+
for _ in current:
614+
walk(head, _)
615+
elif isinstance(current, dict):
616+
for key in current.keys():
617+
value = current[key]
618+
if isinstance(value, (list, tuple, set, dict)):
619+
walk(head, value)
620+
elif isinstance(value, (bool, int, float, basestring)):
621+
original = current[key]
622+
if isinstance(value, bool):
623+
current[key] = "%s%s" % (str(value).lower(), BOUNDED_INJECTION_MARKER)
624+
else:
625+
current[key] = "%s%s" % (value, BOUNDED_INJECTION_MARKER)
626+
candidates["%s #%d%s" % (parameter, len(candidates) + 1, CUSTOM_INJECTION_MARK_CHAR)] = json.dumps(deserialized)
627+
current[key] = original
628+
629+
deserialized = json.loads(testableParameters[parameter])
630+
walk(deserialized)
631+
632+
if candidates:
633+
message = "it appears that provided value for %s parameter '%s' " % (place, parameter)
634+
message += "is JSON deserializable. Do you want to inject inside? [y/N] "
635+
test = readInput(message, default="N")
636+
if test[0] in ("y", "Y"):
637+
del testableParameters[parameter]
638+
testableParameters.update(candidates)
639+
break
640+
except (KeyboardInterrupt, SqlmapUserQuitException):
641+
raise
642+
except Exception:
643+
pass
644+
607645
_ = re.sub(regex, "\g<1>%s\g<%d>" % (CUSTOM_INJECTION_MARK_CHAR, len(match.groups())), testableParameters[parameter])
608646
message = "it appears that provided value for %s parameter '%s' " % (place, parameter)
609647
message += "has boundaries. Do you want to inject inside? ('%s') [y/N] " % _

lib/core/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.revision import getRevisionNumber
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.5.33"
22+
VERSION = "1.0.5.34"
2323
REVISION = getRevisionNumber()
2424
STABLE = VERSION.count('.') <= 2
2525
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")

0 commit comments

Comments
 (0)