mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-01-23 14:49:03 +00:00
More code refactoring of Backend class methods used
This commit is contained in:
@@ -45,7 +45,7 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||
elif Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
self.udfExecCmd(cmd, silent=silent)
|
||||
|
||||
elif Backend.getIdentifiedDbms() == DBMS.MSSQL:
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
self.xpCmdshellExecCmd(cmd, silent=silent)
|
||||
|
||||
else:
|
||||
@@ -59,7 +59,7 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||
elif Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
return self.udfEvalCmd(cmd, first, last)
|
||||
|
||||
elif Backend.getIdentifiedDbms() == DBMS.MSSQL:
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
return self.xpCmdshellEvalCmd(cmd, first, last)
|
||||
|
||||
else:
|
||||
@@ -100,7 +100,7 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||
infoMsg += "command execution"
|
||||
logger.info(infoMsg)
|
||||
|
||||
elif Backend.getIdentifiedDbms() == DBMS.MSSQL:
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
infoMsg = "going to use xp_cmdshell extended procedure for "
|
||||
infoMsg += "operating system command execution"
|
||||
logger.info(infoMsg)
|
||||
@@ -154,7 +154,7 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||
|
||||
if Backend.getIdentifiedDbms() in ( DBMS.MYSQL, DBMS.PGSQL ):
|
||||
self.udfInjectSys()
|
||||
elif Backend.getIdentifiedDbms() == DBMS.MSSQL:
|
||||
elif Backend.isDbms(DBMS.MSSQL):
|
||||
if mandatory:
|
||||
self.xpCmdshellInit()
|
||||
else:
|
||||
|
||||
@@ -189,13 +189,13 @@ class Metasploit:
|
||||
if __payloadStr == "windows/vncinject":
|
||||
choose = False
|
||||
|
||||
if Backend.getIdentifiedDbms() == DBMS.MYSQL:
|
||||
if Backend.isDbms(DBMS.MYSQL):
|
||||
debugMsg = "by default MySQL on Windows runs as SYSTEM "
|
||||
debugMsg += "user, it is likely that the the VNC "
|
||||
debugMsg += "injection will be successful"
|
||||
logger.debug(debugMsg)
|
||||
|
||||
elif Backend.getIdentifiedDbms() == DBMS.PGSQL:
|
||||
elif Backend.isDbms(DBMS.PGSQL):
|
||||
choose = True
|
||||
|
||||
warnMsg = "by default PostgreSQL on Windows runs as "
|
||||
@@ -203,7 +203,7 @@ class Metasploit:
|
||||
warnMsg += "injection will be successful"
|
||||
logger.warn(warnMsg)
|
||||
|
||||
elif Backend.getIdentifiedDbms() == DBMS.MSSQL and Backend.isVersionWithin(("2005", "2008")):
|
||||
elif Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
|
||||
choose = True
|
||||
|
||||
warnMsg = "it is unlikely that the VNC injection will be "
|
||||
@@ -232,12 +232,12 @@ class Metasploit:
|
||||
break
|
||||
|
||||
elif choice == "1":
|
||||
if Backend.getIdentifiedDbms() == DBMS.PGSQL:
|
||||
if Backend.isDbms(DBMS.PGSQL):
|
||||
logger.warn("beware that the VNC injection might not work")
|
||||
|
||||
break
|
||||
|
||||
elif Backend.getIdentifiedDbms() == DBMS.MSSQL and Backend.isVersionWithin(("2005", "2008")):
|
||||
elif Backend.isDbms(DBMS.MSSQL) and Backend.isVersionWithin(("2005", "2008")):
|
||||
break
|
||||
|
||||
elif not choice.isdigit():
|
||||
|
||||
@@ -144,9 +144,9 @@ class UDF:
|
||||
if udf in self.udfToCreate and udf not in self.createdUdf:
|
||||
self.udfCreateFromSharedLib(udf, inpRet)
|
||||
|
||||
if Backend.getIdentifiedDbms() == DBMS.MYSQL:
|
||||
if Backend.isDbms(DBMS.MYSQL):
|
||||
supportTblType = "longtext"
|
||||
elif Backend.getIdentifiedDbms() == DBMS.PGSQL:
|
||||
elif Backend.isDbms(DBMS.PGSQL):
|
||||
supportTblType = "text"
|
||||
|
||||
self.udfCreateSupportTbl(supportTblType)
|
||||
@@ -237,9 +237,9 @@ class UDF:
|
||||
else:
|
||||
logger.warn("you need to specify the name of the UDF")
|
||||
|
||||
if Backend.getIdentifiedDbms() == DBMS.MYSQL:
|
||||
if Backend.isDbms(DBMS.MYSQL):
|
||||
defaultType = "string"
|
||||
elif Backend.getIdentifiedDbms() == DBMS.PGSQL:
|
||||
elif Backend.isDbms(DBMS.PGSQL):
|
||||
defaultType = "text"
|
||||
|
||||
self.udfs[udfName]["input"] = []
|
||||
|
||||
Reference in New Issue
Block a user