Fix for an Issue #323

This commit is contained in:
Miroslav Stampar 2012-12-23 19:34:35 +01:00
parent 832567ecf6
commit a77b7f00d9
3 changed files with 4 additions and 10 deletions

View File

@ -5,7 +5,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import codecs
import os import os
import re import re
import sys import sys
@ -531,7 +530,7 @@ class Metasploit:
errMsg = "failed to create the shellcode (%s)" % payloadStderr.replace("\n", " ").replace("\r", "") errMsg = "failed to create the shellcode (%s)" % payloadStderr.replace("\n", " ").replace("\r", "")
raise SqlmapFilePathException, errMsg raise SqlmapFilePathException, errMsg
self._shellcodeFP = codecs.open(self._shellcodeFilePath, "rb", UNICODE_ENCODING) self._shellcodeFP = open(self._shellcodeFilePath, "rb")
self.shellcodeString = self._shellcodeFP.read() self.shellcodeString = self._shellcodeFP.read()
self._shellcodeFP.close() self._shellcodeFP.close()

View File

@ -5,7 +5,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import codecs
import ntpath import ntpath
import os import os
@ -23,7 +22,6 @@ from lib.core.enums import EXPECTED
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapNoneDataException from lib.core.exception import SqlmapNoneDataException
from lib.core.exception import SqlmapUnsupportedFeatureException from lib.core.exception import SqlmapUnsupportedFeatureException
from lib.core.settings import UNICODE_ENCODING
from lib.request import inject from lib.request import inject
from plugins.generic.filesystem import Filesystem as GenericFilesystem from plugins.generic.filesystem import Filesystem as GenericFilesystem
@ -338,9 +336,8 @@ class Filesystem(GenericFilesystem):
tmpPath = posixToNtSlashes(conf.tmpPath) tmpPath = posixToNtSlashes(conf.tmpPath)
dFile = posixToNtSlashes(dFile) dFile = posixToNtSlashes(dFile)
wFilePointer = codecs.open(wFile, "rb", UNICODE_ENCODING) with open(wFile, "rb") as f:
wFileContent = wFilePointer.read() wFileContent = f.read()
wFilePointer.close()
self._stackedWriteFileVbs(tmpPath, wFileContent, dFile, fileType) self._stackedWriteFileVbs(tmpPath, wFileContent, dFile, fileType)

View File

@ -5,7 +5,6 @@ Copyright (c) 2006-2012 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission See the file 'doc/COPYING' for copying permission
""" """
import codecs
import os import os
from lib.core.agent import agent from lib.core.agent import agent
@ -25,7 +24,6 @@ from lib.core.enums import CHARSET_TYPE
from lib.core.enums import EXPECTED from lib.core.enums import EXPECTED
from lib.core.enums import PAYLOAD from lib.core.enums import PAYLOAD
from lib.core.exception import SqlmapUndefinedMethod from lib.core.exception import SqlmapUndefinedMethod
from lib.core.settings import UNICODE_ENCODING
from lib.request import inject from lib.request import inject
class Filesystem: class Filesystem:
@ -113,7 +111,7 @@ class Filesystem:
""" """
retVal = [] retVal = []
with codecs.open(fileName, "rb", UNICODE_ENCODING) as f: with open(fileName, "rb") as f:
content = f.read().encode(encoding).replace("\n", "") content = f.read().encode(encoding).replace("\n", "")
if not single: if not single: