Skip to content

Commit 1aafe85

Browse files
committed
1 parent fdc8e66 commit 1aafe85

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

lib/core/common.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,7 @@ def dataToOutFile(filename, data):
872872
retVal = os.path.join(conf.filePath, filePathToSafeString(filename))
873873

874874
try:
875-
with openFile(retVal, "wb") as f:
875+
with open(retVal, "w+b") as f:
876876
f.write(data)
877877
except IOError, ex:
878878
errMsg = "something went wrong while trying to write "
@@ -3714,7 +3714,7 @@ def applyFunctionRecursively(value, function):
37143714

37153715
return retVal
37163716

3717-
def decodeHexValue(value):
3717+
def decodeHexValue(value, raw=False):
37183718
"""
37193719
Returns value decoded from DBMS specific hexadecimal representation
37203720
@@ -3729,7 +3729,7 @@ def _(value):
37293729
if value and isinstance(value, basestring) and len(value) % 2 == 0:
37303730
retVal = hexdecode(retVal)
37313731

3732-
if not kb.binaryField:
3732+
if not kb.binaryField and not raw:
37333733
if Backend.isDbms(DBMS.MSSQL) and value.startswith("0x"):
37343734
try:
37353735
retVal = retVal.decode("utf-16-le")

plugins/generic/filesystem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ def readFile(self, remoteFiles):
232232
fileContent = newFileContent
233233

234234
if fileContent is not None:
235-
fileContent = decodeHexValue(fileContent)
235+
fileContent = decodeHexValue(fileContent, True)
236236

237237
if fileContent:
238238
localFilePath = dataToOutFile(remoteFile, fileContent)

0 commit comments

Comments
 (0)