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

Method dbTables

lib/core/dump.py:238–278  ·  view source on GitHub ↗
(self, dbTables)

Source from the content-addressed store, hash-verified

236 self.lister("available databases", dbs, content_type=CONTENT_TYPE.DBS)
237
238 def dbTables(self, dbTables):
239 if isinstance(dbTables, dict) and len(dbTables) > 0:
240 if conf.api:
241 self._write(dbTables, content_type=CONTENT_TYPE.TABLES)
242
243 maxlength = 0
244
245 for tables in dbTables.values():
246 for table in tables:
247 if table and isListLike(table):
248 table = table[0]
249
250 maxlength = max(maxlength, getConsoleLength(unsafeSQLIdentificatorNaming(getUnicode(table))))
251
252 lines = "-" * (int(maxlength) + 2)
253
254 for db, tables in dbTables.items():
255 tables = sorted(filter(None, tables))
256
257 self._write("Database: %s" % unsafeSQLIdentificatorNaming(db) if db and METADB_SUFFIX not in db else "<current>")
258
259 if len(tables) == 1:
260 self._write("[1 table]")
261 else:
262 self._write("[%d tables]" % len(tables))
263
264 self._write("+%s+" % lines)
265
266 for table in tables:
267 if table and isListLike(table):
268 table = table[0]
269
270 table = unsafeSQLIdentificatorNaming(table)
271 blank = " " * (maxlength - getConsoleLength(getUnicode(table)))
272 self._write("| %s%s |" % (table, blank))
273
274 self._write("+%s+\n" % lines)
275 elif dbTables is None or len(dbTables) == 0:
276 self.singleString("No tables found", content_type=CONTENT_TYPE.TABLES)
277 else:
278 self.string("tables", dbTables, content_type=CONTENT_TYPE.TABLES)
279
280 def dbTableColumns(self, tableColumns, content_type=None):
281 if isinstance(tableColumns, dict) and len(tableColumns) > 0:

Callers 3

actionFunction · 0.80
searchTableMethod · 0.80
searchTableMethod · 0.80

Calls 9

_writeMethod · 0.95
singleStringMethod · 0.95
stringMethod · 0.95
isListLikeFunction · 0.90
getConsoleLengthFunction · 0.90
getUnicodeFunction · 0.90
valuesMethod · 0.80
itemsMethod · 0.80

Tested by

no test coverage detected