mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-04 01:47:37 +03:00 
			
		
		
		
	Avoid useless checks for --os-bof (no need to check for DBA or for xp_cmdshell). Minor code restyling.
This commit is contained in:
		
							parent
							
								
									473024bd6e
								
							
						
					
					
						commit
						bb61010a45
					
				| 
						 | 
					@ -95,7 +95,7 @@ class Abstraction(UDF, xp_cmdshell):
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self.execCmd(cmd, forgeCmd=True)
 | 
					            self.execCmd(cmd, forgeCmd=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not conf.osShell and not conf.cleanup:
 | 
					        if not conf.osShell and not conf.osPwn and not conf.cleanup:
 | 
				
			||||||
            self.__cmdShellCleanup()
 | 
					            self.__cmdShellCleanup()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def absOsShell(self):
 | 
					    def absOsShell(self):
 | 
				
			||||||
| 
						 | 
					@ -151,7 +151,7 @@ class Abstraction(UDF, xp_cmdshell):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.checkDbmsOs(detailed)
 | 
					        self.checkDbmsOs(detailed)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not self.isDba():
 | 
					        if mandatory and not self.isDba():
 | 
				
			||||||
            warnMsg  = "the functionality requested might not work because "
 | 
					            warnMsg  = "the functionality requested might not work because "
 | 
				
			||||||
            warnMsg += "the session user is not a database administrator"
 | 
					            warnMsg += "the session user is not a database administrator"
 | 
				
			||||||
            logger.warn(warnMsg)
 | 
					            logger.warn(warnMsg)
 | 
				
			||||||
| 
						 | 
					@ -160,8 +160,11 @@ class Abstraction(UDF, xp_cmdshell):
 | 
				
			||||||
            self.udfInjectCmd()
 | 
					            self.udfInjectCmd()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        elif kb.dbms == "Microsoft SQL Server":
 | 
					        elif kb.dbms == "Microsoft SQL Server":
 | 
				
			||||||
            self.xpCmdshellInit(mandatory)
 | 
					            if mandatory:
 | 
				
			||||||
 | 
					                self.xpCmdshellInit()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            errMsg = "feature not yet implemented for the back-end DBMS"
 | 
					            errMsg = "feature not yet implemented for the back-end DBMS"
 | 
				
			||||||
            raise sqlmapUnsupportedFeatureException, errMsg
 | 
					            raise sqlmapUnsupportedFeatureException(errMsg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        self.envInitialized = True
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -145,7 +145,7 @@ class xp_cmdshell:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return output
 | 
					        return output
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def xpCmdshellInit(self, mandatory=True):
 | 
					    def xpCmdshellInit(self):
 | 
				
			||||||
        self.__xpCmdshellAvailable = False
 | 
					        self.__xpCmdshellAvailable = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        infoMsg  = "checking if xp_cmdshell extended procedure is "
 | 
					        infoMsg  = "checking if xp_cmdshell extended procedure is "
 | 
				
			||||||
| 
						 | 
					@ -187,19 +187,10 @@ class xp_cmdshell:
 | 
				
			||||||
                        warnMsg += "because sp_OACreate is disabled"
 | 
					                        warnMsg += "because sp_OACreate is disabled"
 | 
				
			||||||
                        logger.warn(warnMsg)
 | 
					                        logger.warn(warnMsg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if not self.__xpCmdshellAvailable and not mandatory:
 | 
					        if not self.__xpCmdshellAvailable:
 | 
				
			||||||
            warnMsg  = "unable to get xp_cmdshell working, sqlmap will "
 | 
					 | 
				
			||||||
            warnMsg += "try to proceed without it"
 | 
					 | 
				
			||||||
            logger.warn(warnMsg)
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
            self.envInitialized = True
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        elif not self.__xpCmdshellAvailable:
 | 
					 | 
				
			||||||
            errMsg = "unable to proceed without xp_cmdshell"
 | 
					            errMsg = "unable to proceed without xp_cmdshell"
 | 
				
			||||||
            raise sqlmapUnsupportedFeatureException, errMsg
 | 
					            raise sqlmapUnsupportedFeatureException, errMsg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.envInitialized = True
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        debugMsg  = "creating a support table to write commands standard "
 | 
					        debugMsg  = "creating a support table to write commands standard "
 | 
				
			||||||
        debugMsg += "output to"
 | 
					        debugMsg += "output to"
 | 
				
			||||||
        logger.debug(debugMsg)
 | 
					        logger.debug(debugMsg)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -550,7 +550,6 @@ class MySQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeover):
 | 
				
			||||||
            self.udfSharedLibExt = "so"
 | 
					            self.udfSharedLibExt = "so"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.udfInjectCore(self.sysUdfs)
 | 
					        self.udfInjectCore(self.sysUdfs)
 | 
				
			||||||
        self.envInitialized = True
 | 
					 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
    def uncPathRequest(self):
 | 
					    def uncPathRequest(self):
 | 
				
			||||||
        if not kb.stackedTest:
 | 
					        if not kb.stackedTest:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -464,7 +464,6 @@ class PostgreSQLMap(Fingerprint, Enumeration, Filesystem, Miscellaneous, Takeove
 | 
				
			||||||
            self.udfSharedLibExt = "so"
 | 
					            self.udfSharedLibExt = "so"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.udfInjectCore(self.sysUdfs)
 | 
					        self.udfInjectCore(self.sysUdfs)
 | 
				
			||||||
        self.envInitialized = True
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def uncPathRequest(self):
 | 
					    def uncPathRequest(self):
 | 
				
			||||||
        self.createSupportTbl(self.fileTblName, self.tblField, "text")
 | 
					        self.createSupportTbl(self.fileTblName, self.tblField, "text")
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user