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

Function prioritySortColumns

lib/core/common.py:5157–5169  ·  view source on GitHub ↗

Sorts given column names by length in ascending order while those containing string 'id' go first >>> prioritySortColumns(['password', 'userid', 'name', 'id']) ['id', 'userid', 'name', 'password']

(columns)

Source from the content-addressed store, hash-verified

5155 return filename
5156
5157def prioritySortColumns(columns):
5158 """
5159 Sorts given column names by length in ascending order while those containing
5160 string 'id' go first
5161
5162 >>> prioritySortColumns(['password', 'userid', 'name', 'id'])
5163 ['id', 'userid', 'name', 'password']
5164 """
5165
5166 def _(column):
5167 return column and re.search(r"^id|id$", column, re.I) is not None
5168
5169 return sorted(sorted(columns, key=len), key=functools.cmp_to_key(lambda x, y: -1 if _(x) and not _(y) else 1 if not _(x) and _(y) else 0))
5170
5171def getRequestHeader(request, name):
5172 """

Callers 2

dbTableValuesMethod · 0.90
dumpTableMethod · 0.90

Calls 1

_Function · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…