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

Method getColumns

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

Source from the content-addressed store, hash-verified

162 return kb.data.cachedTables
163
164 def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMode=False):
165 self.forceDbmsEnum()
166
167 if conf.db is None or conf.db == CURRENT_DB:
168 if conf.db is None:
169 warnMsg = "missing database parameter. sqlmap is going "
170 warnMsg += "to use the current database to enumerate "
171 warnMsg += "table(s) columns"
172 logger.warning(warnMsg)
173
174 conf.db = self.getCurrentDb()
175
176 elif conf.db is not None:
177 if ',' in conf.db:
178 errMsg = "only one database name is allowed when enumerating "
179 errMsg += "the tables' columns"
180 raise SqlmapMissingMandatoryOptionException(errMsg)
181
182 conf.db = safeSQLIdentificatorNaming(conf.db)
183
184 if conf.col:
185 colList = conf.col.split(',')
186 else:
187 colList = []
188
189 if conf.exclude:
190 colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
191
192 for col in colList:
193 colList[colList.index(col)] = safeSQLIdentificatorNaming(col)
194
195 if conf.tbl:
196 tblList = conf.tbl.split(',')
197 else:
198 self.getTables()
199
200 if len(kb.data.cachedTables) > 0:
201 tblList = list(six.itervalues(kb.data.cachedTables))
202
203 if tblList and isListLike(tblList[0]):
204 tblList = tblList[0]
205 else:
206 errMsg = "unable to retrieve the tables "
207 errMsg += "on database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
208 raise SqlmapNoneDataException(errMsg)
209
210 for tbl in tblList:
211 tblList[tblList.index(tbl)] = safeSQLIdentificatorNaming(tbl, True)
212
213 if bruteForce:
214 resumeAvailable = False
215
216 for tbl in tblList:
217 for db, table, colName, colType in kb.brute.columns:
218 if db == conf.db and table == tbl:
219 resumeAvailable = True
220 break
221

Callers

nothing calls this directly

Calls 15

getCurrentDbMethod · 0.95
getTablesMethod · 0.95
isListLikeFunction · 0.90
readInputFunction · 0.90
columnExistsFunction · 0.90
isTechniqueAvailableFunction · 0.90
pivotDumpTableFunction · 0.90
filterPairValuesFunction · 0.90

Tested by

no test coverage detected