Minor fix

This commit is contained in:
Miroslav Stampar 2012-12-07 10:57:57 +01:00
parent b5c8707323
commit ed1b5d0ada

View File

@ -11,6 +11,7 @@ import os
from lib.core.agent import agent from lib.core.agent import agent
from lib.core.common import dataToOutFile from lib.core.common import dataToOutFile
from lib.core.common import Backend from lib.core.common import Backend
from lib.core.common import decodeHexValue
from lib.core.common import isNumPosStrValue from lib.core.common import isNumPosStrValue
from lib.core.common import isListLike from lib.core.common import isListLike
from lib.core.common import isTechniqueAvailable from lib.core.common import isTechniqueAvailable
@ -36,23 +37,6 @@ class Filesystem:
self.fileTblName = "sqlmapfile" self.fileTblName = "sqlmapfile"
self.tblField = "data" self.tblField = "data"
def _unhexString(self, hexStr):
if len(hexStr) % 2 != 0:
errMsg = "for some reason(s) sqlmap retrieved an odd-length "
errMsg += "hexadecimal string which it is not able to convert "
errMsg += "to raw string"
logger.error(errMsg)
return hexStr
try:
cleanStr = hexdecode(hexStr)
except TypeError, e:
logger.critical("unable to unhex the string ('%s')" % e)
return None
return cleanStr
def _checkWrittenFile(self, wFile, dFile, fileType): def _checkWrittenFile(self, wFile, dFile, fileType):
if Backend.isDbms(DBMS.MYSQL): if Backend.isDbms(DBMS.MYSQL):
lengthQuery = "SELECT LENGTH(LOAD_FILE('%s'))" % dFile lengthQuery = "SELECT LENGTH(LOAD_FILE('%s'))" % dFile
@ -211,7 +195,7 @@ class Filesystem:
kb.fileReadMode = False kb.fileReadMode = False
if fileContent in ( None, "" ) and not Backend.isDbms(DBMS.PGSQL): if fileContent in (None, "") and not Backend.isDbms(DBMS.PGSQL):
self.cleanup(onlyFileTbl=True) self.cleanup(onlyFileTbl=True)
return return
@ -230,7 +214,7 @@ class Filesystem:
fileContent = newFileContent fileContent = newFileContent
fileContent = self._unhexString(fileContent) fileContent = decodeHexValue(fileContent)
rFilePath = dataToOutFile(fileContent) rFilePath = dataToOutFile(fileContent)
if not Backend.isDbms(DBMS.PGSQL): if not Backend.isDbms(DBMS.PGSQL):