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

Function pivotDumpTable

lib/utils/pivotdumptable.py:39–188  ·  view source on GitHub ↗
(table, colList, count=None, blind=True, alias=None)

Source from the content-addressed store, hash-verified

37from thirdparty.six import unichr as _unichr
38
39def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
40 lengths = {}
41 entries = {}
42
43 dumpNode = queries[Backend.getIdentifiedDbms()].dump_table.blind
44
45 validColumnList = False
46 validPivotValue = False
47
48 if count is None:
49 query = dumpNode.count % table
50 query = agent.whereQuery(query)
51 count = inject.getValue(query, union=False, error=False, expected=EXPECTED.INT, charsetType=CHARSET_TYPE.DIGITS) if blind else inject.getValue(query, blind=False, time=False, expected=EXPECTED.INT)
52
53 if hasattr(count, "isdigit") and count.isdigit():
54 count = int(count)
55
56 if count == 0:
57 infoMsg = "table '%s' appears to be empty" % unsafeSQLIdentificatorNaming(table)
58 logger.info(infoMsg)
59
60 for column in colList:
61 lengths[column] = len(column)
62 entries[column] = []
63
64 return entries, lengths
65
66 elif not isNumPosStrValue(count):
67 return None
68
69 for column in colList:
70 lengths[column] = 0
71 entries[column] = BigArray()
72
73 colList = filterNone(sorted(colList, key=lambda x: len(x) if x else MAX_INT))
74
75 if conf.pivotColumn:
76 for _ in colList:
77 if re.search(r"(.+\.)?%s" % re.escape(conf.pivotColumn), _, re.I):
78 infoMsg = "using column '%s' as a pivot " % conf.pivotColumn
79 infoMsg += "for retrieving row data"
80 logger.info(infoMsg)
81
82 colList.remove(_)
83 colList.insert(0, _)
84
85 validPivotValue = True
86 break
87
88 if not validPivotValue:
89 warnMsg = "column '%s' not " % conf.pivotColumn
90 warnMsg += "found in table '%s'" % table
91 logger.warning(warnMsg)
92
93 if not validPivotValue:
94 for column in colList:
95 infoMsg = "fetching number of distinct "
96 infoMsg += "values for column '%s'" % column.replace(("%s." % alias) if alias else "", "")

Callers 9

dumpTableMethod · 0.90
getPasswordHashesMethod · 0.90
getUsersMethod · 0.90
getDbsMethod · 0.90
getTablesMethod · 0.90
getColumnsMethod · 0.90
getDbsMethod · 0.90
getTablesMethod · 0.90
getColumnsMethod · 0.90

Calls 15

isNumPosStrValueFunction · 0.90
BigArrayClass · 0.90
filterNoneFunction · 0.90
isNoneValueFunction · 0.90
safechardecodeFunction · 0.90
singleTimeWarnMessageFunction · 0.90
unArrayizeValueFunction · 0.90
getUnicodeFunction · 0.90
getSafeExStringFunction · 0.90
xrangeClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…