Minor patch (unicode related)

This commit is contained in:
Miroslav Stampar 2014-12-15 13:36:08 +01:00
parent 35c8e016a8
commit e6de92ce88
4 changed files with 7 additions and 6 deletions

View File

@ -1273,7 +1273,7 @@ def checkConnection(suppressOutput=False):
raise SqlmapConnectionException(errMsg)
except socket.error, ex:
errMsg = "problem occurred while "
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, str(ex))
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getUnicode(ex))
raise SqlmapConnectionException(errMsg)
if not suppressOutput and not conf.dummy:

View File

@ -857,7 +857,7 @@ def dataToDumpFile(dumpFile, data):
dumpFile.write(data)
dumpFile.flush()
except IOError, ex:
if "No space left" in str(ex):
if "No space left" in getUnicode(ex):
errMsg = "no space left on output device"
logger.error(errMsg)
else:

View File

@ -225,7 +225,7 @@ def _setRequestParams():
elif test[0] in ("q", "Q"):
raise SqlmapUserQuitException
for place, value in ((PLACE.URI, conf.url), (PLACE.CUSTOM_POST, conf.data), (PLACE.CUSTOM_HEADER, unicode(conf.httpHeaders))):
for place, value in ((PLACE.URI, conf.url), (PLACE.CUSTOM_POST, conf.data), (PLACE.CUSTOM_HEADER, getUnicode(conf.httpHeaders))):
_ = re.sub(PROBLEMATIC_CUSTOM_INJECTION_PATTERNS, "", value or "") if place == PLACE.CUSTOM_HEADER else value or ""
if CUSTOM_INJECTION_MARK_CHAR in _:
if kb.processUserMarks is None:
@ -610,7 +610,7 @@ def _createTargetDirs():
if conf.data:
f.write("\n\n%s" % getUnicode(conf.data))
except IOError, ex:
if "denied" in str(ex):
if "denied" in getUnicode(ex):
errMsg = "you don't have enough permissions "
else:
errMsg = "something went wrong while trying "

View File

@ -11,6 +11,7 @@ from ConfigParser import MissingSectionHeaderError
from ConfigParser import ParsingError
from lib.core.common import checkFile
from lib.core.common import getUnicode
from lib.core.common import openFile
from lib.core.common import unArrayizeValue
from lib.core.common import UnicodeRawConfigParser
@ -41,7 +42,7 @@ def configFileProxy(section, option, boolean=False, integer=False):
value = config.get(section, option)
except ValueError, ex:
errMsg = "error occurred while processing the option "
errMsg += "'%s' in provided configuration file ('%s')" % (option, str(ex))
errMsg += "'%s' in provided configuration file ('%s')" % (option, getUnicode(ex))
raise SqlmapSyntaxException(errMsg)
if value:
@ -72,7 +73,7 @@ def configFileParser(configFile):
config = UnicodeRawConfigParser()
config.readfp(configFP)
except Exception, ex:
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % str(ex)
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % getUnicode(ex)
raise SqlmapSyntaxException(errMsg)
if not config.has_section("Target"):