mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-01-24 08:14:24 +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.flush()
|
||||
|
||||
def dataToOutFile(data):
|
||||
def dataToOutFile(filename, data):
|
||||
if not data:
|
||||
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:
|
||||
f.write(data)
|
||||
|
|
|
@ -180,12 +180,12 @@ class Filesystem:
|
|||
raise SqlmapUndefinedMethod, errMsg
|
||||
|
||||
def readFile(self, remoteFiles):
|
||||
fileContent = None
|
||||
remoteFilePaths = []
|
||||
localFilePaths = []
|
||||
|
||||
self.checkDbmsOs()
|
||||
|
||||
for remoteFile in remoteFiles.split(","):
|
||||
fileContent = None
|
||||
kb.fileReadMode = True
|
||||
|
||||
if conf.direct or isTechniqueAvailable(PAYLOAD.TECHNIQUE.STACKED):
|
||||
|
@ -207,14 +207,12 @@ class Filesystem:
|
|||
errMsg += "system of the back-end %s server" % Backend.getDbms()
|
||||
logger.error(errMsg)
|
||||
|
||||
return None
|
||||
fileContent = None
|
||||
|
||||
kb.fileReadMode = False
|
||||
|
||||
if fileContent in (None, "") and not Backend.isDbms(DBMS.PGSQL):
|
||||
self.cleanup(onlyFileTbl=True)
|
||||
|
||||
return
|
||||
elif isListLike(fileContent):
|
||||
newFileContent = ""
|
||||
|
||||
|
@ -230,24 +228,23 @@ class Filesystem:
|
|||
|
||||
fileContent = newFileContent
|
||||
|
||||
fileContent = decodeHexValue(fileContent)
|
||||
remoteFilePath = dataToOutFile(fileContent)
|
||||
if fileContent is not None:
|
||||
fileContent = decodeHexValue(fileContent)
|
||||
localFilePath = dataToOutFile(remoteFile, fileContent)
|
||||
|
||||
if not Backend.isDbms(DBMS.PGSQL):
|
||||
self.cleanup(onlyFileTbl=True)
|
||||
if not Backend.isDbms(DBMS.PGSQL):
|
||||
self.cleanup(onlyFileTbl=True)
|
||||
|
||||
sameFile = self.askCheckReadFile(remoteFilePath, remoteFile)
|
||||
sameFile = self.askCheckReadFile(localFilePath, remoteFile)
|
||||
|
||||
if sameFile is True:
|
||||
remoteFilePath += " (same file)"
|
||||
elif sameFile is False:
|
||||
remoteFilePath += " (size differs from remote file)"
|
||||
elif sameFile is None:
|
||||
remoteFilePath += " (size not compared to remote file)"
|
||||
if sameFile is True:
|
||||
localFilePath += " (same file)"
|
||||
elif sameFile is False:
|
||||
localFilePath += " (size differs from remote file)"
|
||||
|
||||
remoteFilePaths.append(remoteFilePath)
|
||||
localFilePaths.append(localFilePath)
|
||||
|
||||
return remoteFilePaths
|
||||
return localFilePaths
|
||||
|
||||
def writeFile(self, localFile, remoteFile, fileType=None):
|
||||
self.checkDbmsOs()
|
||||
|
|
Loading…
Reference in New Issue
Block a user