mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-02 12:59:03 +00:00
Fixing DeprecationWarning (logger.warn)
This commit is contained in:
@@ -211,7 +211,7 @@ class Abstraction(Web, UDF, XP_cmdshell):
|
||||
warnMsg += "were able to extract and crack a DBA "
|
||||
warnMsg += "password by any mean"
|
||||
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
if any((conf.osCmd, conf.osShell)) and Backend.isDbms(DBMS.PGSQL) and self.checkCopyExec():
|
||||
success = True
|
||||
|
||||
@@ -72,7 +72,7 @@ class ICMPsh(object):
|
||||
raise SqlmapDataException("local host address is missing")
|
||||
elif address and not valid:
|
||||
warnMsg = "invalid local host address"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
return address
|
||||
|
||||
|
||||
@@ -206,7 +206,7 @@ class Metasploit(object):
|
||||
warnMsg = "by default PostgreSQL on Windows runs as "
|
||||
warnMsg += "postgres user, it is unlikely that the VNC "
|
||||
warnMsg += "injection will be successful"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
elif Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
|
||||
choose = True
|
||||
@@ -215,7 +215,7 @@ class Metasploit(object):
|
||||
warnMsg += "successful because usually Microsoft SQL Server "
|
||||
warnMsg += "%s runs as Network Service " % Backend.getVersion()
|
||||
warnMsg += "or the Administrator is not logged in"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
if choose:
|
||||
message = "what do you want to do?\n"
|
||||
@@ -236,23 +236,23 @@ class Metasploit(object):
|
||||
|
||||
elif choice == "1":
|
||||
if Backend.isDbms(DBMS.PGSQL):
|
||||
logger.warn("beware that the VNC injection might not work")
|
||||
logger.warning("beware that the VNC injection might not work")
|
||||
break
|
||||
|
||||
elif Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
|
||||
break
|
||||
|
||||
elif not isDigit(choice):
|
||||
logger.warn("invalid value, only digits are allowed")
|
||||
logger.warning("invalid value, only digits are allowed")
|
||||
|
||||
elif int(choice) < 1 or int(choice) > 2:
|
||||
logger.warn("invalid value, it must be 1 or 2")
|
||||
logger.warning("invalid value, it must be 1 or 2")
|
||||
|
||||
if self.connectionStr.startswith("reverse_http") and _payloadStr != "windows/meterpreter":
|
||||
warnMsg = "Reverse HTTP%s connection is only supported " % ("S" if self.connectionStr.endswith("s") else "")
|
||||
warnMsg += "with the Meterpreter payload. Falling back to "
|
||||
warnMsg += "reverse TCP"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
self.connectionStr = "reverse_tcp"
|
||||
|
||||
|
||||
@@ -198,7 +198,7 @@ class UDF(object):
|
||||
if not self.isDba():
|
||||
warnMsg = "functionality requested probably does not work because "
|
||||
warnMsg += "the current session user is not a database administrator"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
if not conf.shLib:
|
||||
msg = "what is the local path of the shared library? "
|
||||
@@ -209,7 +209,7 @@ class UDF(object):
|
||||
if self.udfLocalFile:
|
||||
break
|
||||
else:
|
||||
logger.warn("you need to specify the local path of the shared library")
|
||||
logger.warning("you need to specify the local path of the shared library")
|
||||
else:
|
||||
self.udfLocalFile = conf.shLib
|
||||
|
||||
@@ -249,7 +249,7 @@ class UDF(object):
|
||||
else:
|
||||
break
|
||||
else:
|
||||
logger.warn("invalid value, only digits are allowed")
|
||||
logger.warning("invalid value, only digits are allowed")
|
||||
|
||||
for x in xrange(0, udfCount):
|
||||
while True:
|
||||
@@ -260,7 +260,7 @@ class UDF(object):
|
||||
self.udfs[udfName] = {}
|
||||
break
|
||||
else:
|
||||
logger.warn("you need to specify the name of the UDF")
|
||||
logger.warning("you need to specify the name of the UDF")
|
||||
|
||||
if Backend.isDbms(DBMS.MYSQL):
|
||||
defaultType = "string"
|
||||
@@ -280,7 +280,7 @@ class UDF(object):
|
||||
break
|
||||
|
||||
else:
|
||||
logger.warn("invalid value, only digits >= 0 are allowed")
|
||||
logger.warning("invalid value, only digits >= 0 are allowed")
|
||||
|
||||
for y in xrange(0, parCount):
|
||||
msg = "what is the data-type of input parameter "
|
||||
@@ -290,7 +290,7 @@ class UDF(object):
|
||||
parType = readInput(msg, default=defaultType).strip()
|
||||
|
||||
if parType.isdigit():
|
||||
logger.warn("you need to specify the data-type of the parameter")
|
||||
logger.warning("you need to specify the data-type of the parameter")
|
||||
|
||||
else:
|
||||
self.udfs[udfName]["input"].append(parType)
|
||||
@@ -303,7 +303,7 @@ class UDF(object):
|
||||
retType = readInput(msg, default=defaultType)
|
||||
|
||||
if hasattr(retType, "isdigit") and retType.isdigit():
|
||||
logger.warn("you need to specify the data-type of the return value")
|
||||
logger.warning("you need to specify the data-type of the return value")
|
||||
else:
|
||||
self.udfs[udfName]["return"] = retType
|
||||
break
|
||||
@@ -346,7 +346,7 @@ class UDF(object):
|
||||
else:
|
||||
warnMsg = "invalid value, only digits >= 1 and "
|
||||
warnMsg += "<= %d are allowed" % len(udfList)
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
if not isinstance(choice, int):
|
||||
break
|
||||
@@ -370,7 +370,7 @@ class UDF(object):
|
||||
|
||||
break
|
||||
else:
|
||||
logger.warn("you need to specify the value of the parameter")
|
||||
logger.warning("you need to specify the value of the parameter")
|
||||
|
||||
count += 1
|
||||
|
||||
|
||||
@@ -137,7 +137,7 @@ class Web(object):
|
||||
if "File uploaded" not in (page or ""):
|
||||
warnMsg = "unable to upload the file through the web file "
|
||||
warnMsg += "stager to '%s'" % directory
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
@@ -202,10 +202,10 @@ class Web(object):
|
||||
choice = readInput(message, default=str(default))
|
||||
|
||||
if not isDigit(choice):
|
||||
logger.warn("invalid value, only digits are allowed")
|
||||
logger.warning("invalid value, only digits are allowed")
|
||||
|
||||
elif int(choice) < 1 or int(choice) > len(choices):
|
||||
logger.warn("invalid value, it must be between 1 and %d" % len(choices))
|
||||
logger.warning("invalid value, it must be between 1 and %d" % len(choices))
|
||||
|
||||
else:
|
||||
self.webPlatform = choices[int(choice) - 1]
|
||||
@@ -362,7 +362,7 @@ class Web(object):
|
||||
if "<%" in uplPage or "<?" in uplPage:
|
||||
warnMsg = "file stager uploaded on '%s', " % directory
|
||||
warnMsg += "but not dynamically interpreted"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
continue
|
||||
|
||||
elif self.webPlatform == WEB_PLATFORM.ASPX:
|
||||
@@ -399,7 +399,7 @@ class Web(object):
|
||||
warnMsg += "was able to upload the file stager or "
|
||||
warnMsg += "because the DBMS and web server sit on "
|
||||
warnMsg += "different servers"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
message = "do you want to try the same method used "
|
||||
message += "for the file stager? [Y/n] "
|
||||
|
||||
@@ -270,7 +270,7 @@ class XP_cmdshell(object):
|
||||
kb.xpCmdshellAvailable = True
|
||||
|
||||
else:
|
||||
logger.warn("xp_cmdshell re-enabling failed")
|
||||
logger.warning("xp_cmdshell re-enabling failed")
|
||||
|
||||
logger.info("creating xp_cmdshell with sp_OACreate")
|
||||
self._xpCmdshellConfigure(0)
|
||||
@@ -283,7 +283,7 @@ class XP_cmdshell(object):
|
||||
else:
|
||||
warnMsg = "xp_cmdshell creation failed, probably "
|
||||
warnMsg += "because sp_OACreate is disabled"
|
||||
logger.warn(warnMsg)
|
||||
logger.warning(warnMsg)
|
||||
|
||||
hashDBWrite(HASHDB_KEYS.KB_XP_CMDSHELL_AVAILABLE, kb.xpCmdshellAvailable)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user