Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a77b7f0

Browse files
committed
Fix for an Issue #323
1 parent 832567e commit a77b7f0

3 files changed

Lines changed: 4 additions & 10 deletions

File tree

lib/takeover/metasploit.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
See the file 'doc/COPYING' for copying permission
66
"""
77

8-
import codecs
98
import os
109
import re
1110
import sys
@@ -531,7 +530,7 @@ def createMsfShellcode(self, exitfunc, format, extra, encode):
531530
errMsg = "failed to create the shellcode (%s)" % payloadStderr.replace("\n", " ").replace("\r", "")
532531
raise SqlmapFilePathException, errMsg
533532

534-
self._shellcodeFP = codecs.open(self._shellcodeFilePath, "rb", UNICODE_ENCODING)
533+
self._shellcodeFP = open(self._shellcodeFilePath, "rb")
535534
self.shellcodeString = self._shellcodeFP.read()
536535
self._shellcodeFP.close()
537536

plugins/dbms/mssqlserver/filesystem.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
See the file 'doc/COPYING' for copying permission
66
"""
77

8-
import codecs
98
import ntpath
109
import os
1110

@@ -23,7 +22,6 @@
2322
from lib.core.enums import PAYLOAD
2423
from lib.core.exception import SqlmapNoneDataException
2524
from lib.core.exception import SqlmapUnsupportedFeatureException
26-
from lib.core.settings import UNICODE_ENCODING
2725
from lib.request import inject
2826

2927
from plugins.generic.filesystem import Filesystem as GenericFilesystem
@@ -338,9 +336,8 @@ def stackedWriteFile(self, wFile, dFile, fileType):
338336

339337
tmpPath = posixToNtSlashes(conf.tmpPath)
340338
dFile = posixToNtSlashes(dFile)
341-
wFilePointer = codecs.open(wFile, "rb", UNICODE_ENCODING)
342-
wFileContent = wFilePointer.read()
343-
wFilePointer.close()
339+
with open(wFile, "rb") as f:
340+
wFileContent = f.read()
344341

345342
self._stackedWriteFileVbs(tmpPath, wFileContent, dFile, fileType)
346343

plugins/generic/filesystem.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
See the file 'doc/COPYING' for copying permission
66
"""
77

8-
import codecs
98
import os
109

1110
from lib.core.agent import agent
@@ -25,7 +24,6 @@
2524
from lib.core.enums import EXPECTED
2625
from lib.core.enums import PAYLOAD
2726
from lib.core.exception import SqlmapUndefinedMethod
28-
from lib.core.settings import UNICODE_ENCODING
2927
from lib.request import inject
3028

3129
class Filesystem:
@@ -113,7 +111,7 @@ def fileEncode(self, fileName, encoding, single):
113111
"""
114112

115113
retVal = []
116-
with codecs.open(fileName, "rb", UNICODE_ENCODING) as f:
114+
with open(fileName, "rb") as f:
117115
content = f.read().encode(encoding).replace("\n", "")
118116

119117
if not single:

0 commit comments

Comments
 (0)