(self)
| 171 | return kb.data.cachedTables |
| 172 | |
| 173 | def searchTable(self): |
| 174 | foundTbls = {} |
| 175 | tblList = conf.tbl.split(',') |
| 176 | rootQuery = queries[DBMS.MSSQL].search_table |
| 177 | tblCond = rootQuery.inband.condition |
| 178 | tblConsider, tblCondParam = self.likeOrExact("table") |
| 179 | |
| 180 | if conf.db == CURRENT_DB: |
| 181 | conf.db = self.getCurrentDb() |
| 182 | |
| 183 | if conf.db: |
| 184 | enumDbs = conf.db.split(',') |
| 185 | elif not len(kb.data.cachedDbs): |
| 186 | enumDbs = self.getDbs() |
| 187 | else: |
| 188 | enumDbs = kb.data.cachedDbs |
| 189 | |
| 190 | for db in enumDbs: |
| 191 | db = safeSQLIdentificatorNaming(db) |
| 192 | foundTbls[db] = [] |
| 193 | |
| 194 | for tbl in tblList: |
| 195 | tbl = safeSQLIdentificatorNaming(tbl, True) |
| 196 | |
| 197 | infoMsg = "searching table" |
| 198 | if tblConsider == "1": |
| 199 | infoMsg += "s LIKE" |
| 200 | infoMsg += " '%s'" % unsafeSQLIdentificatorNaming(tbl) |
| 201 | logger.info(infoMsg) |
| 202 | |
| 203 | tblQuery = "%s%s" % (tblCond, tblCondParam) |
| 204 | tblQuery = tblQuery % unsafeSQLIdentificatorNaming(tbl) |
| 205 | |
| 206 | for db in foundTbls.keys(): |
| 207 | db = safeSQLIdentificatorNaming(db) |
| 208 | |
| 209 | if conf.excludeSysDbs and db in self.excludeDbsList: |
| 210 | infoMsg = "skipping system database '%s'" % db |
| 211 | singleTimeLogMessage(infoMsg) |
| 212 | continue |
| 213 | |
| 214 | if conf.exclude and re.search(conf.exclude, db, re.I) is not None: |
| 215 | infoMsg = "skipping database '%s'" % db |
| 216 | singleTimeLogMessage(infoMsg) |
| 217 | continue |
| 218 | |
| 219 | if any(isTechniqueAvailable(_) for _ in (PAYLOAD.TECHNIQUE.UNION, PAYLOAD.TECHNIQUE.ERROR, PAYLOAD.TECHNIQUE.QUERY)) or conf.direct: |
| 220 | query = rootQuery.inband.query.replace("%s", db) |
| 221 | query += tblQuery |
| 222 | values = inject.getValue(query, blind=False, time=False) |
| 223 | |
| 224 | if not isNoneValue(values): |
| 225 | if isinstance(values, six.string_types): |
| 226 | values = [values] |
| 227 | |
| 228 | for foundTbl in values: |
| 229 | if foundTbl is None: |
| 230 | continue |
nothing calls this directly
no test coverage detected