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

@@ -66,7 +66,7 @@ def tableExists(tableFile, regex=None):
if kb.choices.tableExists is None and not any(_ for _ in kb.injection.data if _ not in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED)) and not conf.direct:
warnMsg = "it's not recommended to use '%s' and/or '%s' " % (PAYLOAD.SQLINJECTION[PAYLOAD.TECHNIQUE.TIME], PAYLOAD.SQLINJECTION[PAYLOAD.TECHNIQUE.STACKED])
warnMsg += "for common table existence check"
logger.warn(warnMsg)
logger.warning(warnMsg)
message = "are you sure you want to continue? [y/N] "
kb.choices.tableExists = readInput(message, default='N', boolean=True)
@@ -160,7 +160,7 @@ def tableExists(tableFile, regex=None):
except KeyboardInterrupt:
warnMsg = "user aborted during table existence "
warnMsg += "check. sqlmap will display partial output"
logger.warn(warnMsg)
logger.warning(warnMsg)
clearConsoleLine(True)
dataToStdout("\n")
@@ -169,7 +169,7 @@ def tableExists(tableFile, regex=None):
warnMsg = "no table(s) found"
if conf.db:
warnMsg += " for database '%s'" % conf.db
logger.warn(warnMsg)
logger.warning(warnMsg)
else:
for item in threadData.shared.files:
if conf.db not in kb.data.cachedTables:
@@ -190,7 +190,7 @@ def columnExists(columnFile, regex=None):
if kb.choices.columnExists is None and not any(_ for _ in kb.injection.data if _ not in (PAYLOAD.TECHNIQUE.TIME, PAYLOAD.TECHNIQUE.STACKED)) and not conf.direct:
warnMsg = "it's not recommended to use '%s' and/or '%s' " % (PAYLOAD.SQLINJECTION[PAYLOAD.TECHNIQUE.TIME], PAYLOAD.SQLINJECTION[PAYLOAD.TECHNIQUE.STACKED])
warnMsg += "for common column existence check"
logger.warn(warnMsg)
logger.warning(warnMsg)
message = "are you sure you want to continue? [y/N] "
kb.choices.columnExists = readInput(message, default='N', boolean=True)
@@ -281,7 +281,7 @@ def columnExists(columnFile, regex=None):
except KeyboardInterrupt:
warnMsg = "user aborted during column existence "
warnMsg += "check. sqlmap will display partial output"
logger.warn(warnMsg)
logger.warning(warnMsg)
finally:
kb.bruteMode = False
@@ -290,7 +290,7 @@ def columnExists(columnFile, regex=None):
if not threadData.shared.files:
warnMsg = "no column(s) found"
logger.warn(warnMsg)
logger.warning(warnMsg)
else:
columns = {}
@@ -394,7 +394,7 @@ def fileExists(pathFile):
except KeyboardInterrupt:
warnMsg = "user aborted during file existence "
warnMsg += "check. sqlmap will display partial output"
logger.warn(warnMsg)
logger.warning(warnMsg)
finally:
kb.bruteMode = False
logger.setLevel(popValue())
@@ -404,7 +404,7 @@ def fileExists(pathFile):
if not threadData.shared.files:
warnMsg = "no file(s) found"
logger.warn(warnMsg)
logger.warning(warnMsg)
else:
retVal = threadData.shared.files

View File

@@ -162,7 +162,7 @@ def crawl(target, post=None, cookie=None):
except SqlmapConnectionException as ex:
if "page not found" in getSafeExString(ex):
found = False
logger.warn("'sitemap.xml' not found")
logger.warning("'sitemap.xml' not found")
except:
pass
finally:
@@ -198,7 +198,7 @@ def crawl(target, post=None, cookie=None):
except KeyboardInterrupt:
warnMsg = "user aborted during crawling. sqlmap "
warnMsg += "will use partial list"
logger.warn(warnMsg)
logger.warning(warnMsg)
finally:
clearConsoleLine(True)
@@ -208,7 +208,7 @@ def crawl(target, post=None, cookie=None):
warnMsg = "no usable links found (with GET parameters)"
if conf.forms:
warnMsg += " or forms"
logger.warn(warnMsg)
logger.warning(warnMsg)
else:
for url in threadData.shared.value:
kb.targets.add((urldecode(url, kb.pageEncoding), None, None, None, None))

View File

@@ -26,7 +26,7 @@ def checkDependencies():
warnMsg = "'%s' third-party library must be " % data[1]
warnMsg += "version >= 1.0.2 to work properly. "
warnMsg += "Download from '%s'" % data[2]
logger.warn(warnMsg)
logger.warning(warnMsg)
elif dbmsName == DBMS.MYSQL:
__import__("pymysql")
elif dbmsName in (DBMS.PGSQL, DBMS.CRATEDB):
@@ -62,7 +62,7 @@ def checkDependencies():
warnMsg = "sqlmap requires '%s' third-party library " % data[1]
warnMsg += "in order to directly connect to the DBMS "
warnMsg += "'%s'. Download from '%s'" % (dbmsName, data[2])
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add(data[1])
continue
@@ -78,7 +78,7 @@ def checkDependencies():
warnMsg = "sqlmap requires 'python-impacket' third-party library for "
warnMsg += "out-of-band takeover feature. Download from "
warnMsg += "'https://github.com/coresecurity/impacket'"
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add('python-impacket')
try:
@@ -89,7 +89,7 @@ def checkDependencies():
warnMsg = "sqlmap requires 'python-ntlm' third-party library "
warnMsg += "if you plan to attack a web application behind NTLM "
warnMsg += "authentication. Download from 'https://github.com/mullender/python-ntlm'"
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add('python-ntlm')
try:
@@ -100,7 +100,7 @@ def checkDependencies():
warnMsg = "sqlmap requires 'websocket-client' third-party library "
warnMsg += "if you plan to attack a web application using WebSocket. "
warnMsg += "Download from 'https://pypi.python.org/pypi/websocket-client/'"
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add('websocket-client')
try:
@@ -110,7 +110,7 @@ def checkDependencies():
except ImportError:
warnMsg = "sqlmap requires 'tkinter' library "
warnMsg += "if you plan to run a GUI"
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add('tkinter')
try:
@@ -120,7 +120,7 @@ def checkDependencies():
except ImportError:
warnMsg = "sqlmap requires 'tkinter.ttk' library "
warnMsg += "if you plan to run a GUI"
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add('tkinter.ttk')
if IS_WIN:
@@ -134,7 +134,7 @@ def checkDependencies():
warnMsg += "completion and history support features in the SQL "
warnMsg += "shell and OS shell. Download from "
warnMsg += "'https://pypi.org/project/pyreadline/'"
logger.warn(warnMsg)
logger.warning(warnMsg)
missing_libraries.add('python-pyreadline')
if len(missing_libraries) == 0:

View File

@@ -701,7 +701,7 @@ def attackDumpedTable():
_ = ','.join(binary_fields)
warnMsg = "potential binary fields detected ('%s'). In case of any problems you are " % _
warnMsg += "advised to rerun table dump with '--fresh-queries --binary-fields=\"%s\"'" % _
logger.warn(warnMsg)
logger.warning(warnMsg)
for i in xrange(count):
if not found and i > HASH_RECOGNITION_QUIT_THRESHOLD:
@@ -1064,7 +1064,7 @@ def dictionaryAttack(attack_dict):
item = [(user, hash_), {"salt": hash_[4:12], "count": 1 << ITOA64.index(hash_[3]), "prefix": hash_[:3]}]
else:
warnMsg = "invalid hash '%s'" % hash_
logger.warn(warnMsg)
logger.warning(warnMsg)
if item and hash_ not in keys:
resumed = hashDBRetrieve(hash_)
@@ -1197,7 +1197,7 @@ def dictionaryAttack(attack_dict):
print()
processException = True
warnMsg = "user aborted during dictionary-based attack phase (Ctrl+C was pressed)"
logger.warn(warnMsg)
logger.warning(warnMsg)
finally:
_finalize(retVal, results, processes, attack_info)
@@ -1272,7 +1272,7 @@ def dictionaryAttack(attack_dict):
print()
processException = True
warnMsg = "user aborted during dictionary-based attack phase (Ctrl+C was pressed)"
logger.warn(warnMsg)
logger.warning(warnMsg)
for process in processes:
try:
@@ -1290,11 +1290,11 @@ def dictionaryAttack(attack_dict):
if foundHash and len(hash_regexes) == 0:
warnMsg = "unknown hash format"
logger.warn(warnMsg)
logger.warning(warnMsg)
if len(results) == 0:
warnMsg = "no clear password(s) found"
logger.warn(warnMsg)
logger.warning(warnMsg)
return results

View File

@@ -116,7 +116,7 @@ class HashDB(object):
retVal = None
warnMsg = "error occurred while unserializing value for session key '%s'. " % key
warnMsg += "If the problem persists please rerun with '--flush-session'"
logger.warn(warnMsg)
logger.warning(warnMsg)
return retVal
@@ -163,7 +163,7 @@ class HashDB(object):
if retries == 0:
warnMsg = "there has been a problem while writing to "
warnMsg += "the session file ('%s')" % getSafeExString(ex)
logger.warn(warnMsg)
logger.warning(warnMsg)
if retries >= HASHDB_FLUSH_RETRIES:
return

View File

@@ -88,7 +88,7 @@ def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
if not validPivotValue:
warnMsg = "column '%s' not " % conf.pivotColumn
warnMsg += "found in table '%s'" % table
logger.warn(warnMsg)
logger.warning(warnMsg)
if not validPivotValue:
for column in colList:
@@ -120,7 +120,7 @@ def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
if not validPivotValue:
warnMsg = "no proper pivot column provided (with unique values)."
warnMsg += " It won't be possible to retrieve all rows"
logger.warn(warnMsg)
logger.warning(warnMsg)
pivotValue = " "
breakRetrieval = False
@@ -177,7 +177,7 @@ def pivotDumpTable(table, colList, count=None, blind=True, alias=None):
warnMsg = "user aborted during enumeration. sqlmap "
warnMsg += "will display partial output"
logger.warn(warnMsg)
logger.warning(warnMsg)
except SqlmapConnectionException as ex:
errMsg = "connection exception detected ('%s'). sqlmap " % getSafeExString(ex)

View File

@@ -26,7 +26,7 @@ def purge(directory):
if not os.path.isdir(directory):
warnMsg = "skipping purging of directory '%s' as it does not exist" % directory
logger.warn(warnMsg)
logger.warning(warnMsg)
return
infoMsg = "purging content of directory '%s'..." % directory

View File

@@ -196,7 +196,7 @@ def search(dork):
logger.critical(getSafeExString(ex))
warnMsg = "changing proxy"
logger.warn(warnMsg)
logger.warning(warnMsg)
conf.proxy = None