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

Function zeroDepthSearch

lib/core/common.py:5211–5237  ·  view source on GitHub ↗

Searches occurrences of value inside expression at 0-depth level regarding the parentheses >>> _ = "SELECT (SELECT id FROM users WHERE 2>1) AS result FROM DUAL"; _[zeroDepthSearch(_, "FROM")[0]:] 'FROM DUAL' >>> _ = "a(b; c),d;e"; _[zeroDepthSearch(_, "[;, ]")[0]:] ',d;e'

(expression, value)

Source from the content-addressed store, hash-verified

5209 return True
5210
5211def zeroDepthSearch(expression, value):
5212 """
5213 Searches occurrences of value inside expression at 0-depth level
5214 regarding the parentheses
5215
5216 >>> _ = "SELECT (SELECT id FROM users WHERE 2>1) AS result FROM DUAL"; _[zeroDepthSearch(_, "FROM")[0]:]
5217 'FROM DUAL'
5218 >>> _ = "a(b; c),d;e"; _[zeroDepthSearch(_, "[;, ]")[0]:]
5219 ',d;e'
5220 """
5221
5222 retVal = []
5223
5224 depth = 0
5225 for index in xrange(len(expression)):
5226 if expression[index] == '(':
5227 depth += 1
5228 elif expression[index] == ')':
5229 depth -= 1
5230 elif depth == 0:
5231 if value.startswith('[') and value.endswith(']'):
5232 if re.search(value, expression[index:index + 1]):
5233 retVal.append(index)
5234 elif expression[index:index + len(value)] == value:
5235 retVal.append(index)
5236
5237 return retVal
5238
5239def splitFields(fields, delimiter=','):
5240 """

Callers 6

getFieldsMethod · 0.90
concatQueryMethod · 0.90
forgeUnionQueryMethod · 0.90
tamperFunction · 0.90
tamperFunction · 0.90
splitFieldsFunction · 0.85

Calls 3

xrangeClass · 0.85
searchMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…