Skip to content

Commit e623ee6

Browse files
committed
Better approach for sqlmapproject#1320
1 parent bcb2582 commit e623ee6

File tree

8 files changed

+11
-11
lines changed

8 files changed

+11
-11
lines changed

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1298,7 +1298,7 @@ def checkConnection(suppressOutput=False):
12981298
raise SqlmapConnectionException(errMsg)
12991299
except socket.error, ex:
13001300
errMsg = "problem occurred while "
1301-
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, getUnicode(ex))
1301+
errMsg += "resolving a host name '%s' ('%s')" % (conf.hostname, ex.message)
13021302
raise SqlmapConnectionException(errMsg)
13031303

13041304
if not suppressOutput and not conf.dummy and not conf.offline:

lib/core/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ def dataToOutFile(filename, data):
876876
f.write(data)
877877
except IOError, ex:
878878
errMsg = "something went wrong while trying to write "
879-
errMsg += "to the output file ('%s')" % getUnicode(ex)
879+
errMsg += "to the output file ('%s')" % ex.message
880880
raise SqlmapGenericException(errMsg)
881881

882882
return retVal
@@ -3662,7 +3662,7 @@ def evaluateCode(code, variables=None):
36623662
except KeyboardInterrupt:
36633663
raise
36643664
except Exception, ex:
3665-
errMsg = "an error occurred while evaluating provided code ('%s') " % getUnicode(ex)
3665+
errMsg = "an error occurred while evaluating provided code ('%s') " % ex.message
36663666
raise SqlmapGenericException(errMsg)
36673667

36683668
def serializeObject(object_):

lib/core/dump.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def _write(self, data, newline=True, console=True, content_type=None):
7474
try:
7575
self._outputFP.write(text)
7676
except IOError, ex:
77-
errMsg = "error occurred while writing to log file ('%s')" % getUnicode(ex)
77+
errMsg = "error occurred while writing to log file ('%s')" % ex.message
7878
raise SqlmapGenericException(errMsg)
7979

8080
if kb.get("multiThreadMode"):
@@ -94,7 +94,7 @@ def setOutputFile(self):
9494
try:
9595
self._outputFP = openFile(self._outputFile, "ab" if not conf.flushSession else "wb")
9696
except IOError, ex:
97-
errMsg = "error occurred while opening log file ('%s')" % getUnicode(ex)
97+
errMsg = "error occurred while opening log file ('%s')" % ex.message
9898
raise SqlmapGenericException(errMsg)
9999

100100
def getOutputFile(self):

lib/core/option.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1521,7 +1521,7 @@ def _createTemporaryDirectory():
15211521
os.makedirs(tempfile.gettempdir())
15221522
except IOError, ex:
15231523
errMsg = "there has been a problem while accessing "
1524-
errMsg += "system's temporary directory location(s) ('%s'). Please " % getUnicode(ex)
1524+
errMsg += "system's temporary directory location(s) ('%s'). Please " % ex.message
15251525
errMsg += "make sure that there is enough disk space left. If problem persists, "
15261526
errMsg += "try to set environment variable 'TEMP' to a location "
15271527
errMsg += "writeable by the current user"

lib/parse/cmdline.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -862,7 +862,7 @@ def _(self, *args):
862862
for arg in shlex.split(command):
863863
argv.append(getUnicode(arg, encoding=sys.stdin.encoding))
864864
except ValueError, ex:
865-
raise SqlmapSyntaxException, "something went wrong during command line parsing ('%s')" % getUnicode(ex)
865+
raise SqlmapSyntaxException, "something went wrong during command line parsing ('%s')" % ex.message
866866

867867
# Hide non-basic options in basic help case
868868
for i in xrange(len(argv)):

lib/parse/configfile.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def configFileParser(configFile):
7373
config = UnicodeRawConfigParser()
7474
config.readfp(configFP)
7575
except Exception, ex:
76-
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % getUnicode(ex)
76+
errMsg = "you have provided an invalid and/or unreadable configuration file ('%s')" % ex.message
7777
raise SqlmapSyntaxException(errMsg)
7878

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

lib/utils/hash.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -770,7 +770,7 @@ def dictionaryAttack(attack_dict):
770770

771771
except Exception, ex:
772772
warnMsg = "there was a problem while loading dictionaries"
773-
warnMsg += " ('%s')" % getUnicode(ex)
773+
warnMsg += " ('%s')" % ex.message
774774
logger.critical(warnMsg)
775775

776776
message = "do you want to use common password suffixes? (slow!) [y/N] "

plugins/generic/entries.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,13 +341,13 @@ def dumpTable(self, foundData=None):
341341
attackDumpedTable()
342342
except (IOError, OSError), ex:
343343
errMsg = "an error occurred while attacking "
344-
errMsg += "table dump ('%s')" % getUnicode(ex)
344+
errMsg += "table dump ('%s')" % ex.message
345345
logger.critical(errMsg)
346346
conf.dumper.dbTableValues(kb.data.dumpedTable)
347347

348348
except SqlmapConnectionException, ex:
349349
errMsg = "connection exception detected in dumping phase "
350-
errMsg += "('%s')" % getUnicode(ex)
350+
errMsg += "('%s')" % ex.message
351351
logger.critical(errMsg)
352352

353353
finally:

0 commit comments

Comments
 (0)