mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-28 18:20:33 +03:00
minor improvement when --dbs returns no database names (like in many cases with MySQL 4)
This commit is contained in:
parent
5eb7787fc9
commit
af39a441fa
|
@ -692,29 +692,36 @@ class Enumeration:
|
||||||
|
|
||||||
if not isNumPosStrValue(count):
|
if not isNumPosStrValue(count):
|
||||||
errMsg = "unable to retrieve the number of databases"
|
errMsg = "unable to retrieve the number of databases"
|
||||||
raise sqlmapNoneDataException, errMsg
|
logger.error(errMsg)
|
||||||
|
|
||||||
if Backend.getIdentifiedDbms() == DBMS.ORACLE:
|
|
||||||
plusOne = True
|
|
||||||
else:
|
else:
|
||||||
plusOne = False
|
if Backend.getIdentifiedDbms() == DBMS.ORACLE:
|
||||||
indexRange = getRange(count, plusOne=plusOne)
|
plusOne = True
|
||||||
|
|
||||||
for index in indexRange:
|
|
||||||
if Backend.getIdentifiedDbms() == DBMS.SYBASE:
|
|
||||||
query = rootQuery.blind.query % (kb.data.cachedDbs[-1] if kb.data.cachedDbs else " ")
|
|
||||||
elif Backend.getIdentifiedDbms() == DBMS.MYSQL and not kb.data.has_information_schema:
|
|
||||||
query = rootQuery.blind.query2 % index
|
|
||||||
else:
|
else:
|
||||||
query = rootQuery.blind.query % index
|
plusOne = False
|
||||||
db = inject.getValue(query, inband=False, error=False)
|
indexRange = getRange(count, plusOne=plusOne)
|
||||||
|
|
||||||
if db:
|
for index in indexRange:
|
||||||
kb.data.cachedDbs.append(db)
|
if Backend.getIdentifiedDbms() == DBMS.SYBASE:
|
||||||
|
query = rootQuery.blind.query % (kb.data.cachedDbs[-1] if kb.data.cachedDbs else " ")
|
||||||
|
elif Backend.getIdentifiedDbms() == DBMS.MYSQL and not kb.data.has_information_schema:
|
||||||
|
query = rootQuery.blind.query2 % index
|
||||||
|
else:
|
||||||
|
query = rootQuery.blind.query % index
|
||||||
|
db = inject.getValue(query, inband=False, error=False)
|
||||||
|
|
||||||
|
if db:
|
||||||
|
kb.data.cachedDbs.append(db)
|
||||||
|
|
||||||
if not kb.data.cachedDbs:
|
if not kb.data.cachedDbs:
|
||||||
errMsg = "unable to retrieve the database names"
|
infoMsg = "falling back to current database"
|
||||||
raise sqlmapNoneDataException, errMsg
|
logger.info(infoMsg)
|
||||||
|
self.getCurrentDb()
|
||||||
|
|
||||||
|
if kb.data.currentDb:
|
||||||
|
kb.data.cachedDbs = [kb.data.currentDb]
|
||||||
|
else:
|
||||||
|
errMsg = "unable to retrieve the database names"
|
||||||
|
raise sqlmapNoneDataException, errMsg
|
||||||
|
|
||||||
return kb.data.cachedDbs
|
return kb.data.cachedDbs
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user