Fixing DeprecationWarning (logger.warn)

This commit is contained in:
Miroslav Stampar
2022-06-22 12:04:34 +02:00
parent 90b444c927
commit df4293473d
99 changed files with 429 additions and 428 deletions

View File

@@ -65,7 +65,7 @@ class Custom(object):
elif not isStackingAvailable() and not conf.direct:
warnMsg = "execution of non-query SQL statements is only "
warnMsg += "available when stacked queries are supported"
logger.warn(warnMsg)
logger.warning(warnMsg)
return None
else:
@@ -80,7 +80,7 @@ class Custom(object):
output = NULL
except SqlmapNoneDataException as ex:
logger.warn(ex)
logger.warning(ex)
return output

View File

@@ -106,13 +106,13 @@ class Databases(object):
warnMsg = "information_schema not available, "
warnMsg += "back-end DBMS is MySQL < 5. database "
warnMsg += "names will be fetched from 'mysql' database"
logger.warn(warnMsg)
logger.warning(warnMsg)
elif Backend.getIdentifiedDbms() in (DBMS.ORACLE, DBMS.DB2, DBMS.PGSQL, DBMS.MONETDB, DBMS.DERBY, DBMS.VERTICA, DBMS.PRESTO, DBMS.MIMERSQL, DBMS.CRATEDB, DBMS.CACHE, DBMS.FRONTBASE):
warnMsg = "schema names are going to be used on %s " % Backend.getIdentifiedDbms()
warnMsg += "for enumeration as the counterpart to database "
warnMsg += "names on other DBMSes"
logger.warn(warnMsg)
logger.warning(warnMsg)
infoMsg = "fetching database (schema) names"
@@ -120,7 +120,7 @@ class Databases(object):
warnMsg = "user names are going to be used on %s " % Backend.getIdentifiedDbms()
warnMsg += "for enumeration as the counterpart to database "
warnMsg += "names on other DBMSes"
logger.warn(warnMsg)
logger.warning(warnMsg)
infoMsg = "fetching database (user) names"
@@ -220,7 +220,7 @@ class Databases(object):
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
warnMsg = "information_schema not available, "
warnMsg += "back-end DBMS is MySQL < 5.0"
logger.warn(warnMsg)
logger.warning(warnMsg)
bruteForce = True
elif Backend.getIdentifiedDbms() in (DBMS.MCKOI, DBMS.EXTREMEDB, DBMS.RAIMA):
@@ -235,7 +235,7 @@ class Databases(object):
if not tables:
warnMsg = "cannot retrieve table names, "
warnMsg += "back-end DBMS is %s" % Backend.getIdentifiedDbms()
logger.warn(warnMsg)
logger.warning(warnMsg)
bruteForce = True
else:
return tables
@@ -381,7 +381,7 @@ class Databases(object):
if count == 0:
warnMsg = "database '%s' " % unsafeSQLIdentificatorNaming(db)
warnMsg += "appears to be empty"
logger.warn(warnMsg)
logger.warning(warnMsg)
break
elif not isNumPosStrValue(count):
@@ -441,7 +441,7 @@ class Databases(object):
else:
warnMsg = "unable to retrieve the table names "
warnMsg += "for database '%s'" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
logger.warning(warnMsg)
if isNoneValue(kb.data.cachedTables):
kb.data.cachedTables.clear()
@@ -471,7 +471,7 @@ class Databases(object):
warnMsg = "missing database parameter. sqlmap is going "
warnMsg += "to use the current database to enumerate "
warnMsg += "table(s) columns"
logger.warn(warnMsg)
logger.warning(warnMsg)
conf.db = self.getCurrentDb()
@@ -542,7 +542,7 @@ class Databases(object):
if Backend.isDbms(DBMS.MYSQL) and not kb.data.has_information_schema:
warnMsg = "information_schema not available, "
warnMsg += "back-end DBMS is MySQL < 5.0"
logger.warn(warnMsg)
logger.warning(warnMsg)
bruteForce = True
elif Backend.getIdentifiedDbms() in (DBMS.ACCESS, DBMS.MCKOI, DBMS.EXTREMEDB, DBMS.RAIMA):
@@ -925,7 +925,7 @@ class Databases(object):
warnMsg += ("table '%s' " % unsafeSQLIdentificatorNaming(unArrayizeValue(tblList))) if len(tblList) == 1 else "any table "
if METADB_SUFFIX not in conf.db:
warnMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
logger.warn(warnMsg)
logger.warning(warnMsg)
if bruteForce is None:
return self.getColumns(onlyColNames=onlyColNames, colTuple=colTuple, bruteForce=True)
@@ -994,7 +994,7 @@ class Databases(object):
warnMsg = "missing table parameter, sqlmap will retrieve "
warnMsg += "the number of entries for all database "
warnMsg += "management system databases' tables"
logger.warn(warnMsg)
logger.warning(warnMsg)
elif "." in conf.tbl:
if not conf.db:
@@ -1004,7 +1004,7 @@ class Databases(object):
warnMsg = "missing database parameter. sqlmap is going to "
warnMsg += "use the current database to retrieve the "
warnMsg += "number of entries for table '%s'" % unsafeSQLIdentificatorNaming(conf.tbl)
logger.warn(warnMsg)
logger.warning(warnMsg)
conf.db = self.getCurrentDb()

View File

@@ -68,7 +68,7 @@ class Entries(object):
warnMsg = "missing database parameter. sqlmap is going "
warnMsg += "to use the current database to enumerate "
warnMsg += "table(s) entries"
logger.warn(warnMsg)
logger.warning(warnMsg)
conf.db = self.getCurrentDb()
@@ -142,7 +142,7 @@ class Entries(object):
if METADB_SUFFIX not in conf.db:
warnMsg += " in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
warnMsg += ", skipping" if len(tblList) > 1 else ""
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
@@ -157,7 +157,7 @@ class Entries(object):
if METADB_SUFFIX not in conf.db:
warnMsg += " in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
warnMsg += " (no usable column names)"
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
kb.dumpColumns = [unsafeSQLIdentificatorNaming(_) for _ in colList]
@@ -222,7 +222,7 @@ class Entries(object):
kb.dumpKeyboardInterrupt = True
clearConsoleLine()
warnMsg = "Ctrl+C detected in dumping phase"
logger.warn(warnMsg)
logger.warning(warnMsg)
if isNoneValue(entries) and not kb.dumpKeyboardInterrupt:
try:
@@ -232,7 +232,7 @@ class Entries(object):
kb.dumpKeyboardInterrupt = True
clearConsoleLine()
warnMsg = "Ctrl+C detected in dumping phase"
logger.warn(warnMsg)
logger.warning(warnMsg)
if retVal:
entries, _ = retVal
@@ -254,7 +254,7 @@ class Entries(object):
kb.dumpKeyboardInterrupt = True
clearConsoleLine()
warnMsg = "Ctrl+C detected in dumping phase"
logger.warn(warnMsg)
logger.warning(warnMsg)
if not isNoneValue(entries):
if isinstance(entries, six.string_types):
@@ -314,7 +314,7 @@ class Entries(object):
warnMsg = "table '%s' " % unsafeSQLIdentificatorNaming(tbl)
warnMsg += "in database '%s' " % unsafeSQLIdentificatorNaming(conf.db)
warnMsg += "appears to be empty"
logger.warn(warnMsg)
logger.warning(warnMsg)
for column in colList:
lengths[column] = len(column)
@@ -326,7 +326,7 @@ class Entries(object):
warnMsg += "column(s) '%s' " % colNames
warnMsg += "entries for table '%s' " % unsafeSQLIdentificatorNaming(tbl)
warnMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(conf.db)
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
@@ -366,7 +366,7 @@ class Entries(object):
kb.dumpKeyboardInterrupt = True
clearConsoleLine()
warnMsg = "Ctrl+C detected in dumping phase"
logger.warn(warnMsg)
logger.warning(warnMsg)
if not entries and not kb.dumpKeyboardInterrupt:
try:
@@ -376,7 +376,7 @@ class Entries(object):
kb.dumpKeyboardInterrupt = True
clearConsoleLine()
warnMsg = "Ctrl+C detected in dumping phase"
logger.warn(warnMsg)
logger.warning(warnMsg)
if retVal:
entries, lengths = retVal
@@ -437,7 +437,7 @@ class Entries(object):
kb.dumpKeyboardInterrupt = True
clearConsoleLine()
warnMsg = "Ctrl+C detected in dumping phase"
logger.warn(warnMsg)
logger.warning(warnMsg)
for column, columnEntries in entries.items():
length = max(lengths[column], len(column))
@@ -452,7 +452,7 @@ class Entries(object):
warnMsg += "of columns '%s' " % colNames
warnMsg += "for table '%s' " % unsafeSQLIdentificatorNaming(tbl)
warnMsg += "in database '%s'%s" % (unsafeSQLIdentificatorNaming(conf.db), " (permission denied)" if kb.permissionFlag else "")
logger.warn(warnMsg)
logger.warning(warnMsg)
else:
kb.data.dumpedTable["__infos__"] = {"count": entriesCount,
"table": safeSQLIdentificatorNaming(tbl, True),

View File

@@ -62,7 +62,7 @@ class Filesystem(object):
localFileSize = os.path.getsize(localFile)
except OSError:
warnMsg = "file '%s' is missing" % localFile
logger.warn(warnMsg)
logger.warning(warnMsg)
localFileSize = 0
if fileRead and Backend.isDbms(DBMS.PGSQL):
@@ -95,7 +95,7 @@ class Filesystem(object):
warnMsg = "it looks like the file has not been written (usually "
warnMsg += "occurs if the DBMS process user has no write "
warnMsg += "privileges in the destination path)"
logger.warn(warnMsg)
logger.warning(warnMsg)
return sameFile

View File

@@ -40,7 +40,7 @@ class Fingerprint(object):
def userChooseDbmsOs(self):
warnMsg = "for some reason sqlmap was unable to fingerprint "
warnMsg += "the back-end DBMS operating system"
logger.warn(warnMsg)
logger.warning(warnMsg)
msg = "do you want to provide the OS? [(W)indows/(l)inux]"
@@ -55,4 +55,4 @@ class Fingerprint(object):
break
else:
warnMsg = "invalid value"
logger.warn(warnMsg)
logger.warning(warnMsg)

View File

@@ -183,7 +183,7 @@ class Miscellaneous(object):
warnMsg += "saved on the file system can only be deleted "
warnMsg += "manually"
logger.warn(warnMsg)
logger.warning(warnMsg)
def likeOrExact(self, what):
message = "do you want sqlmap to consider provided %s(s):\n" % what

View File

@@ -119,7 +119,7 @@ class Search(object):
if dbConsider == "1":
warnMsg += "s LIKE"
warnMsg += " '%s' found" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
@@ -249,7 +249,7 @@ class Search(object):
if tblConsider == "1":
warnMsg += "s LIKE"
warnMsg += " '%s'" % unsafeSQLIdentificatorNaming(tbl)
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
@@ -302,7 +302,7 @@ class Search(object):
warnMsg += "s LIKE"
warnMsg += " '%s' " % unsafeSQLIdentificatorNaming(tbl)
warnMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
@@ -339,7 +339,7 @@ class Search(object):
if not foundTbls:
warnMsg = "no databases contain any of the provided tables"
logger.warn(warnMsg)
logger.warning(warnMsg)
return
conf.dumper.dbTables(foundTbls)
@@ -507,7 +507,7 @@ class Search(object):
if colConsider == "1":
warnMsg += "s LIKE"
warnMsg += " '%s'" % unsafeSQLIdentificatorNaming(column)
logger.warn("%s%s" % (warnMsg, infoMsgTbl))
logger.warning("%s%s" % (warnMsg, infoMsgTbl))
continue
@@ -566,7 +566,7 @@ class Search(object):
warnMsg += "s LIKE"
warnMsg += " '%s' " % unsafeSQLIdentificatorNaming(column)
warnMsg += "in database '%s'" % unsafeSQLIdentificatorNaming(db)
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
@@ -620,7 +620,7 @@ class Search(object):
else:
warnMsg = "no databases have tables containing any of the "
warnMsg += "provided columns"
logger.warn(warnMsg)
logger.warning(warnMsg)
def search(self):
if Backend.getIdentifiedDbms() in UPPER_CASE_DBMSES:

View File

@@ -122,7 +122,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry):
else:
warnMsg = "invalid value, valid values are '1' and '2'"
logger.warn(warnMsg)
logger.warning(warnMsg)
else:
tunnel = 1
@@ -193,7 +193,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry):
else:
warnMsg = "invalid value, valid values are '1' and '2'"
logger.warn(warnMsg)
logger.warning(warnMsg)
if choice == 1:
goUdf = True
@@ -251,7 +251,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry):
warnMsg = "sqlmap does not implement any operating system "
warnMsg += "user privilege escalation technique when the "
warnMsg += "back-end DBMS underlying system is not Windows"
logger.warn(warnMsg)
logger.warning(warnMsg)
if tunnel == 1:
self.createMsfShellcode(exitfunc="process", format="raw", extra="BufferRegister=EAX", encode="x86/alpha_mixed")
@@ -326,7 +326,7 @@ class Takeover(Abstraction, Metasploit, ICMPsh, Registry):
printWarn = False
if printWarn:
logger.warn(warnMsg)
logger.warning(warnMsg)
self.smb()

View File

@@ -301,7 +301,7 @@ class Users(object):
if not isNumPosStrValue(count):
warnMsg = "unable to retrieve the number of password "
warnMsg += "hashes for user '%s'" % user
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
infoMsg = "fetching password hashes for user '%s'" % user
@@ -345,7 +345,7 @@ class Users(object):
else:
warnMsg = "unable to retrieve the password "
warnMsg += "hashes for user '%s'" % user
logger.warn(warnMsg)
logger.warning(warnMsg)
retrievedUsers.add(user)
@@ -547,7 +547,7 @@ class Users(object):
warnMsg = "unable to retrieve the number of "
warnMsg += "privileges for user '%s'" % outuser
logger.warn(warnMsg)
logger.warning(warnMsg)
continue
infoMsg = "fetching privileges for user '%s'" % outuser
@@ -650,7 +650,7 @@ class Users(object):
else:
warnMsg = "unable to retrieve the privileges "
warnMsg += "for user '%s'" % outuser
logger.warn(warnMsg)
logger.warning(warnMsg)
retrievedUsers.add(user)
@@ -668,6 +668,6 @@ class Users(object):
def getRoles(self, query2=False):
warnMsg = "on %s the concept of roles does not " % Backend.getIdentifiedDbms()
warnMsg += "exist. sqlmap will enumerate privileges instead"
logger.warn(warnMsg)
logger.warning(warnMsg)
return self.getPrivileges(query2)