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

Method getColumns

plugins/generic/databases.py:466–933  ·  view source on GitHub ↗
(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMode=False)

Source from the content-addressed store, hash-verified

464 return kb.data.cachedTables
465
466 def getColumns(self, onlyColNames=False, colTuple=None, bruteForce=None, dumpMode=False):
467 self.forceDbmsEnum()
468
469 if conf.db is None or conf.db == CURRENT_DB:
470 if conf.db is None:
471 warnMsg = "missing database parameter. sqlmap is going "
472 warnMsg += "to use the current database to enumerate "
473 warnMsg += "table(s) columns"
474 logger.warning(warnMsg)
475
476 conf.db = self.getCurrentDb()
477
478 if not conf.db:
479 errMsg = "unable to retrieve the current "
480 errMsg += "database name"
481 raise SqlmapNoneDataException(errMsg)
482
483 elif conf.db is not None:
484 if Backend.getIdentifiedDbms() in UPPER_CASE_DBMSES:
485 conf.db = conf.db.upper()
486
487 if ',' in conf.db:
488 errMsg = "only one database name is allowed when enumerating "
489 errMsg += "the tables' columns"
490 raise SqlmapMissingMandatoryOptionException(errMsg)
491
492 conf.db = safeSQLIdentificatorNaming(conf.db)
493
494 if conf.col:
495 if Backend.getIdentifiedDbms() in UPPER_CASE_DBMSES:
496 conf.col = conf.col.upper()
497
498 colList = conf.col.split(',')
499 else:
500 colList = []
501
502 if conf.exclude:
503 colList = [_ for _ in colList if re.search(conf.exclude, _, re.I) is None]
504
505 for col in colList:
506 colList[colList.index(col)] = safeSQLIdentificatorNaming(col)
507
508 colList = [_ for _ in colList if _]
509
510 if conf.tbl:
511 if Backend.getIdentifiedDbms() in UPPER_CASE_DBMSES:
512 conf.tbl = conf.tbl.upper()
513
514 tblList = conf.tbl.split(',')
515 else:
516 self.getTables()
517
518 if len(kb.data.cachedTables) > 0:
519 if conf.db in kb.data.cachedTables:
520 tblList = kb.data.cachedTables[conf.db]
521 else:
522 tblList = list(six.itervalues(kb.data.cachedTables))
523

Callers 5

getSchemaMethod · 0.95
actionFunction · 0.45
expandAsteriskForColumnsFunction · 0.45
dumpTableMethod · 0.45
searchColumnMethod · 0.45

Calls 15

getCurrentDbMethod · 0.95
getTablesMethod · 0.95
isListLikeFunction · 0.90
filterNoneFunction · 0.90
singleTimeWarnMessageFunction · 0.90
readInputFunction · 0.90
columnExistsFunction · 0.90
isTechniqueAvailableFunction · 0.90

Tested by

no test coverage detected