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

Method getColumns

plugins/dbms/maxdb/enumeration.py:103–225  ·  view source on GitHub ↗
(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMode=False)

Source from the content-addressed store, hash-verified

101 return kb.data.cachedTables
102
103 def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMode=False):
104 self.forceDbmsEnum()
105
106 if conf.db is None or conf.db == CURRENT_DB:
107 if conf.db is None:
108 warnMsg = "missing database parameter. sqlmap is going "
109 warnMsg += "to use the current database to enumerate "
110 warnMsg += "table(s) columns"
111 logger.warning(warnMsg)
112
113 conf.db = self.getCurrentDb()
114
115 elif conf.db is not None:
116 if ',' in conf.db:
117 errMsg = "only one database name is allowed when enumerating "
118 errMsg += "the tables' columns"
119 raise SqlmapMissingMandatoryOptionException(errMsg)
120
121 conf.db = safeSQLIdentificatorNaming(conf.db)
122
123 if conf.col:
124 colList = conf.col.split(',')
125 else:
126 colList = []
127
128 if conf.exclude:
129 colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
130
131 for col in colList:
132 colList[colList.index(col)] = safeSQLIdentificatorNaming(col)
133
134 if conf.tbl:
135 tblList = conf.tbl.split(',')
136 else:
137 self.getTables()
138
139 if len(kb.data.cachedTables) > 0:
140 tblList = list(kb.data.cachedTables.values())
141
142 if tblList and isListLike(tblList[0]):
143 tblList = tblList[0]
144 else:
145 errMsg = "unable to retrieve the tables "
146 errMsg += "on database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
147 raise SqlmapNoneDataException(errMsg)
148
149 for tbl in tblList:
150 tblList[tblList.index(tbl)] = safeSQLIdentificatorNaming(tbl, True)
151
152 if bruteForce:
153 resumeAvailable = False
154
155 for tbl in tblList:
156 for db, table, colName, colType in kb.brute.columns:
157 if db == conf.db and table == tbl:
158 resumeAvailable = True
159 break
160

Callers 1

searchColumnMethod · 0.95

Calls 15

getCurrentDbMethod · 0.95
getTablesMethod · 0.95
isListLikeFunction · 0.90
readInputFunction · 0.90
columnExistsFunction · 0.90
isTechniqueAvailableFunction · 0.90
pivotDumpTableFunction · 0.90
valuesMethod · 0.80

Tested by

no test coverage detected