MCPcopy Index your code
hub / github.com/sqlmapproject/sqlmap / walk

Function walk

lib/core/common.py:693–716  ·  view source on GitHub ↗
(head, current=None)

Source from the content-addressed store, hash-verified

691 candidates = OrderedDict()
692
693 def walk(head, current=None):
694 if current is None:
695 current = head
696 if isListLike(current):
697 for _ in current:
698 walk(head, _)
699 elif isinstance(current, dict):
700 for key in current.keys():
701 value = current[key]
702 if isinstance(value, (bool, int, float, six.string_types)) or value in (None, []):
703 original = current[key]
704 if isinstance(value, bool):
705 current[key] = "%s%s" % (getUnicode(value).lower(), BOUNDED_INJECTION_MARKER)
706 elif value is None:
707 current[key] = "%s%s" % (randomInt(), BOUNDED_INJECTION_MARKER)
708 elif value == []:
709 current[key] = ["%s%s" % (randomInt(), BOUNDED_INJECTION_MARKER)]
710 else:
711 current[key] = "%s%s" % (value, BOUNDED_INJECTION_MARKER)
712 candidates["%s (%s)" % (parameter, key)] = re.sub(r"\b(%s\s*=\s*)%s" % (re.escape(parameter), re.escape(testableParameters[parameter])), r"\g<1>%s" % json.dumps(deserialized, separators=(',', ':') if ", " not in testableParameters[parameter] else None), parameters)
713 current[key] = original
714 elif isinstance(value, (list, tuple, set, dict)):
715 if value:
716 walk(head, value)
717
718 # NOTE: for cases with custom injection marker(s) inside (e.g. https://github.com/sqlmapproject/sqlmap/issues/4137#issuecomment-2013783111) - p.s. doesn't care too much about the structure (e.g. injection into the flat array values)
719 if CUSTOM_INJECTION_MARK_CHAR in testableParameters[parameter]:

Callers 1

paramToDictFunction · 0.85

Calls 5

getUnicodeFunction · 0.90
randomIntFunction · 0.85
isListLikeFunction · 0.70
keysMethod · 0.45
escapeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…