mirror of
				https://github.com/sqlmapproject/sqlmap.git
				synced 2025-11-04 09:57:38 +03:00 
			
		
		
		
	fixed bug related to issue #223
This commit is contained in:
		
							parent
							
								
									27a12ae85b
								
							
						
					
					
						commit
						cefb03c835
					
				| 
						 | 
					@ -736,11 +736,11 @@ def dataToDumpFile(dumpFile, data):
 | 
				
			||||||
    dumpFile.write(data)
 | 
					    dumpFile.write(data)
 | 
				
			||||||
    dumpFile.flush()
 | 
					    dumpFile.flush()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def dataToOutFile(data):
 | 
					def dataToOutFile(filename, data):
 | 
				
			||||||
    if not data:
 | 
					    if not data:
 | 
				
			||||||
        return "No data retrieved"
 | 
					        return "No data retrieved"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    retVal = "%s%s%s" % (conf.filePath, os.sep, filePathToString(conf.rFile))
 | 
					    retVal = "%s%s%s" % (conf.filePath, os.sep, filePathToString(filename))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    with codecs.open(retVal, "wb") as f:
 | 
					    with codecs.open(retVal, "wb") as f:
 | 
				
			||||||
        f.write(data)
 | 
					        f.write(data)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -180,12 +180,12 @@ class Filesystem:
 | 
				
			||||||
        raise SqlmapUndefinedMethod, errMsg
 | 
					        raise SqlmapUndefinedMethod, errMsg
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def readFile(self, remoteFiles):
 | 
					    def readFile(self, remoteFiles):
 | 
				
			||||||
        fileContent = None
 | 
					        localFilePaths = []
 | 
				
			||||||
        remoteFilePaths = []
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        self.checkDbmsOs()
 | 
					        self.checkDbmsOs()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        for remoteFile in remoteFiles.split(","):
 | 
					        for remoteFile in remoteFiles.split(","):
 | 
				
			||||||
 | 
					            fileContent = None
 | 
				
			||||||
            kb.fileReadMode = True
 | 
					            kb.fileReadMode = True
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if conf.direct or isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
 | 
					            if conf.direct or isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
 | 
				
			||||||
| 
						 | 
					@ -207,14 +207,12 @@ class Filesystem:
 | 
				
			||||||
                errMsg += "system of the back-end %s server" % Backend.getDbms()
 | 
					                errMsg += "system of the back-end %s server" % Backend.getDbms()
 | 
				
			||||||
                logger.error(errMsg)
 | 
					                logger.error(errMsg)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                return None
 | 
					                fileContent = None
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            kb.fileReadMode = False
 | 
					            kb.fileReadMode = False
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if fileContent in (None, "") and not Backend.isDbms(DBMS.PGSQL):
 | 
					            if fileContent in (None, "") and not Backend.isDbms(DBMS.PGSQL):
 | 
				
			||||||
                self.cleanup(onlyFileTbl=True)
 | 
					                self.cleanup(onlyFileTbl=True)
 | 
				
			||||||
 | 
					 | 
				
			||||||
                return
 | 
					 | 
				
			||||||
            elif isListLike(fileContent):
 | 
					            elif isListLike(fileContent):
 | 
				
			||||||
                newFileContent = ""
 | 
					                newFileContent = ""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -230,24 +228,23 @@ class Filesystem:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                fileContent = newFileContent
 | 
					                fileContent = newFileContent
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            fileContent = decodeHexValue(fileContent)
 | 
					            if fileContent is not None:
 | 
				
			||||||
            remoteFilePath = dataToOutFile(fileContent)
 | 
					                fileContent = decodeHexValue(fileContent)
 | 
				
			||||||
 | 
					                localFilePath = dataToOutFile(remoteFile, fileContent)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if not Backend.isDbms(DBMS.PGSQL):
 | 
					                if not Backend.isDbms(DBMS.PGSQL):
 | 
				
			||||||
                self.cleanup(onlyFileTbl=True)
 | 
					                    self.cleanup(onlyFileTbl=True)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            sameFile = self.askCheckReadFile(remoteFilePath, remoteFile)
 | 
					                sameFile = self.askCheckReadFile(localFilePath, remoteFile)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if sameFile is True:
 | 
					                if sameFile is True:
 | 
				
			||||||
                remoteFilePath += " (same file)"
 | 
					                    localFilePath += " (same file)"
 | 
				
			||||||
            elif sameFile is False:
 | 
					                elif sameFile is False:
 | 
				
			||||||
                remoteFilePath += " (size differs from remote file)"
 | 
					                    localFilePath += " (size differs from remote file)"
 | 
				
			||||||
            elif sameFile is None:
 | 
					 | 
				
			||||||
                remoteFilePath += " (size not compared to remote file)"
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
            remoteFilePaths.append(remoteFilePath)
 | 
					                localFilePaths.append(localFilePath)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return remoteFilePaths
 | 
					        return localFilePaths
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def writeFile(self, localFile, remoteFile, fileType=None):
 | 
					    def writeFile(self, localFile, remoteFile, fileType=None):
 | 
				
			||||||
        self.checkDbmsOs()
 | 
					        self.checkDbmsOs()
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user