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

Skip to content

Commit e6de92c

Browse files
committed
Minor patch (unicode related)
1 parent 35c8e01 commit e6de92c

4 files changed

Lines changed: 7 additions & 6 deletions

File tree

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1273,7 +1273,7 @@ def checkConnection(suppressOutput=False):
12731273
raise SqlmapConnectionException(errMsg)
12741274
except socket.error, ex:
12751275
errMsg = "problem occurred while "
1276-
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, str(ex))
1276+
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getUnicode(ex))
12771277
raise SqlmapConnectionException(errMsg)
12781278

12791279
if not suppressOutput and not conf.dummy:

lib/core/common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -857,7 +857,7 @@ def dataToDumpFile(dumpFile, data):
857857
dumpFile.write(data)
858858
dumpFile.flush()
859859
except IOError, ex:
860-
if "No space left" in str(ex):
860+
if "No space left" in getUnicode(ex):
861861
errMsg = "no space left on output device"
862862
logger.error(errMsg)
863863
else:

lib/core/target.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ def process(match, repl):
225225
elif test[0] in ("q", "Q"):
226226
raise SqlmapUserQuitException
227227

228-
for place, value in ((PLACE.URI, conf.url), (PLACE.CUSTOM_POST, conf.data), (PLACE.CUSTOM_HEADER, unicode(conf.httpHeaders))):
228+
for place, value in ((PLACE.URI, conf.url), (PLACE.CUSTOM_POST, conf.data), (PLACE.CUSTOM_HEADER, getUnicode(conf.httpHeaders))):
229229
_ = re.sub(PROBLEMATIC_CUSTOM_INJECTION_PATTERNS, "", value or "") if place == PLACE.CUSTOM_HEADER else value or ""
230230
if CUSTOM_INJECTION_MARK_CHAR in _:
231231
if kb.processUserMarks is None:
@@ -610,7 +610,7 @@ def _createTargetDirs():
610610
if conf.data:
611611
f.write("\n\n%s" % getUnicode(conf.data))
612612
except IOError, ex:
613-
if "denied" in str(ex):
613+
if "denied" in getUnicode(ex):
614614
errMsg = "you don't have enough permissions "
615615
else:
616616
errMsg = "something went wrong while trying "

lib/parse/configfile.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from ConfigParser import ParsingError
1212

1313
from lib.core.common import checkFile
14+
from lib.core.common import getUnicode
1415
from lib.core.common import openFile
1516
from lib.core.common import unArrayizeValue
1617
from lib.core.common import UnicodeRawConfigParser
@@ -41,7 +42,7 @@ def configFileProxy(section, option, boolean=False, integer=False):
4142
value = config.get(section, option)
4243
except ValueError, ex:
4344
errMsg = "error occurred while processing the option "
44-
errMsg += "'%s' in provided configuration file ('%s')" % (option, str(ex))
45+
errMsg += "'%s' in provided configuration file ('%s')" % (option, getUnicode(ex))
4546
raise SqlmapSyntaxException(errMsg)
4647

4748
if value:
@@ -72,7 +73,7 @@ def configFileParser(configFile):
7273
config = UnicodeRawConfigParser()
7374
config.readfp(configFP)
7475
except Exception, ex:
75-
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % str(ex)
76+
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % getUnicode(ex)
7677
raise SqlmapSyntaxException(errMsg)
7778

7879
if not config.has_section("Target"):

0 commit comments

Comments
 (0)