This commit is contained in:
Miroslav Stampar 2015-07-15 11:15:06 +02:00
parent fdc8e664df
commit 1aafe85a3a
2 changed files with 4 additions and 4 deletions

View File

@ -872,7 +872,7 @@ def dataToOutFile(filename, data):
retVal = os.path.join(conf.filePath, filePathToSafeString(filename)) retVal = os.path.join(conf.filePath, filePathToSafeString(filename))
try: try:
with openFile(retVal, "wb") as f: with open(retVal, "w+b") as f:
f.write(data) f.write(data)
except IOError, ex: except IOError, ex:
errMsg = "something went wrong while trying to write " errMsg = "something went wrong while trying to write "
@ -3714,7 +3714,7 @@ def applyFunctionRecursively(value, function):
return retVal return retVal
def decodeHexValue(value): def decodeHexValue(value, raw=False):
""" """
Returns value decoded from DBMS specific hexadecimal representation Returns value decoded from DBMS specific hexadecimal representation
@ -3729,7 +3729,7 @@ def decodeHexValue(value):
if value and isinstance(value, basestring) and len(value) % 2 == 0: if value and isinstance(value, basestring) and len(value) % 2 == 0:
retVal = hexdecode(retVal) retVal = hexdecode(retVal)
if not kb.binaryField: if not kb.binaryField and not raw:
if Backend.isDbms(DBMS.MSSQL) and value.startswith("0x"): if Backend.isDbms(DBMS.MSSQL) and value.startswith("0x"):
try: try:
retVal = retVal.decode("utf-16-le") retVal = retVal.decode("utf-16-le")

View File

@ -232,7 +232,7 @@ class Filesystem:
fileContent = newFileContent fileContent = newFileContent
if fileContent is not None: if fileContent is not None:
fileContent = decodeHexValue(fileContent) fileContent = decodeHexValue(fileContent, True)
if fileContent: if fileContent:
localFilePath = dataToOutFile(remoteFile, fileContent) localFilePath = dataToOutFile(remoteFile, fileContent)