mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-03-23 19:34:13 +03:00
Avoid to check for existence of not needed UDFs and minor code adjustment for cleanup() method
This commit is contained in:
parent
b08a4efb4b
commit
5c92fad5dc
|
@ -46,18 +46,6 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||||
Web.__init__(self)
|
Web.__init__(self)
|
||||||
xp_cmdshell.__init__(self)
|
xp_cmdshell.__init__(self)
|
||||||
|
|
||||||
def __cmdShellCleanup(self):
|
|
||||||
if not conf.cleanup:
|
|
||||||
if kb.dbms in ( "MySQL", "PostgreSQL" ):
|
|
||||||
self.cleanup()
|
|
||||||
|
|
||||||
elif kb.dbms == "Microsoft SQL Server":
|
|
||||||
self.cleanup(onlyFileTbl=True)
|
|
||||||
|
|
||||||
else:
|
|
||||||
errMsg = "Feature not yet implemented for the back-end DBMS"
|
|
||||||
raise sqlmapUnsupportedFeatureException, errMsg
|
|
||||||
|
|
||||||
def execCmd(self, cmd, silent=False, forgeCmd=False):
|
def execCmd(self, cmd, silent=False, forgeCmd=False):
|
||||||
if self.webBackdoorUrl and not kb.stackedTest:
|
if self.webBackdoorUrl and not kb.stackedTest:
|
||||||
self.webBackdoorRunCmd(cmd)
|
self.webBackdoorRunCmd(cmd)
|
||||||
|
@ -103,9 +91,6 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||||
else:
|
else:
|
||||||
self.execCmd(cmd, forgeCmd=True)
|
self.execCmd(cmd, forgeCmd=True)
|
||||||
|
|
||||||
if not conf.osShell and not conf.osPwn and not conf.cleanup:
|
|
||||||
self.__cmdShellCleanup()
|
|
||||||
|
|
||||||
def shell(self):
|
def shell(self):
|
||||||
if self.webBackdoorUrl and not kb.stackedTest:
|
if self.webBackdoorUrl and not kb.stackedTest:
|
||||||
infoMsg = "calling OS shell. To quit type "
|
infoMsg = "calling OS shell. To quit type "
|
||||||
|
@ -157,8 +142,6 @@ class Abstraction(Web, UDF, xp_cmdshell):
|
||||||
|
|
||||||
self.runCmd(command)
|
self.runCmd(command)
|
||||||
|
|
||||||
self.__cmdShellCleanup()
|
|
||||||
|
|
||||||
def initEnv(self, mandatory=True, detailed=False, web=False):
|
def initEnv(self, mandatory=True, detailed=False, web=False):
|
||||||
if self.envInitialized:
|
if self.envInitialized:
|
||||||
return
|
return
|
||||||
|
|
|
@ -116,6 +116,13 @@ class UDF:
|
||||||
|
|
||||||
return output
|
return output
|
||||||
|
|
||||||
|
def checkNeededUdfs(self):
|
||||||
|
if not conf.osPwn:
|
||||||
|
self.sysUdfs.pop("sys_bineval")
|
||||||
|
|
||||||
|
if not conf.osCmd and not conf.osShell and not conf.regRead:
|
||||||
|
self.sysUdfs.pop("sys_eval")
|
||||||
|
|
||||||
def udfCreateFromSharedLib(self):
|
def udfCreateFromSharedLib(self):
|
||||||
errMsg = "udfSetRemotePath() method must be defined within the plugin"
|
errMsg = "udfSetRemotePath() method must be defined within the plugin"
|
||||||
raise sqlmapUnsupportedFeatureException(errMsg)
|
raise sqlmapUnsupportedFeatureException(errMsg)
|
||||||
|
|
|
@ -560,6 +560,7 @@ class MySQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
|
||||||
self.udfLocalFile += "/mysql/linux/lib_mysqludf_sys.so"
|
self.udfLocalFile += "/mysql/linux/lib_mysqludf_sys.so"
|
||||||
self.udfSharedLibExt = "so"
|
self.udfSharedLibExt = "so"
|
||||||
|
|
||||||
|
self.checkNeededUdfs()
|
||||||
self.udfInjectCore(self.sysUdfs)
|
self.udfInjectCore(self.sysUdfs)
|
||||||
|
|
||||||
def uncPathRequest(self):
|
def uncPathRequest(self):
|
||||||
|
|
|
@ -469,6 +469,7 @@ class PostgreSQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeove
|
||||||
self.udfLocalFile += "/postgresql/linux/%s/lib_postgresqludf_sys.so" % majorVer
|
self.udfLocalFile += "/postgresql/linux/%s/lib_postgresqludf_sys.so" % majorVer
|
||||||
self.udfSharedLibExt = "so"
|
self.udfSharedLibExt = "so"
|
||||||
|
|
||||||
|
self.checkNeededUdfs()
|
||||||
self.udfInjectCore(self.sysUdfs)
|
self.udfInjectCore(self.sysUdfs)
|
||||||
|
|
||||||
def uncPathRequest(self):
|
def uncPathRequest(self):
|
||||||
|
|
|
@ -100,6 +100,9 @@ class Takeover(Abstraction, Metasploit, Registry):
|
||||||
if not web or (web and self.webBackdoorUrl is not None):
|
if not web or (web and self.webBackdoorUrl is not None):
|
||||||
self.runCmd(conf.osCmd)
|
self.runCmd(conf.osCmd)
|
||||||
|
|
||||||
|
if not conf.osShell and not conf.osPwn and not conf.cleanup:
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
def osShell(self):
|
def osShell(self):
|
||||||
stackedTest()
|
stackedTest()
|
||||||
|
|
||||||
|
@ -120,6 +123,9 @@ class Takeover(Abstraction, Metasploit, Registry):
|
||||||
if not web or (web and self.webBackdoorUrl is not None):
|
if not web or (web and self.webBackdoorUrl is not None):
|
||||||
self.shell()
|
self.shell()
|
||||||
|
|
||||||
|
if not conf.osPwn and not conf.cleanup:
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
def osPwn(self):
|
def osPwn(self):
|
||||||
goUdf = False
|
goUdf = False
|
||||||
|
|
||||||
|
@ -228,6 +234,9 @@ class Takeover(Abstraction, Metasploit, Registry):
|
||||||
if not web or (web and self.webBackdoorUrl is not None):
|
if not web or (web and self.webBackdoorUrl is not None):
|
||||||
self.pwn(goUdf)
|
self.pwn(goUdf)
|
||||||
|
|
||||||
|
if not conf.cleanup:
|
||||||
|
self.cleanup()
|
||||||
|
|
||||||
def osSmb(self):
|
def osSmb(self):
|
||||||
stackedTest()
|
stackedTest()
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user