Skip to content

Commit eb98946

Browse files
committed
Minor just in case update
1 parent 9b716fc commit eb98946

File tree

6 files changed

+20
-18
lines changed

6 files changed

+20
-18
lines changed

lib/controller/checks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1243,7 +1243,7 @@ def _(*args, **kwargs):
12431243
found = function(_)
12441244
except Exception, ex:
12451245
errMsg = "exception occurred while running "
1246-
errMsg += "WAF script for '%s' ('%s')" % (product, ex)
1246+
errMsg += "WAF script for '%s' ('%s')" % (product, getSafeExString(ex))
12471247
logger.critical(errMsg)
12481248

12491249
found = False

lib/core/common.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -853,7 +853,7 @@ def dataToTrafficFile(data):
853853
conf.trafficFP.flush()
854854
except IOError, ex:
855855
errMsg = "something went wrong while trying "
856-
errMsg += "to write to the traffic file '%s' ('%s')" % (conf.trafficFile, ex)
856+
errMsg += "to write to the traffic file '%s' ('%s')" % (conf.trafficFile, getSafeExString(ex))
857857
raise SqlmapSystemException(errMsg)
858858

859859
def dataToDumpFile(dumpFile, data):
@@ -1276,7 +1276,7 @@ def parseTargetUrl():
12761276
try:
12771277
urlSplit = urlparse.urlsplit(conf.url)
12781278
except ValueError, ex:
1279-
errMsg = "invalid URL '%s' has been given ('%s'). " % (conf.url, ex)
1279+
errMsg = "invalid URL '%s' has been given ('%s'). " % (conf.url, getSafeExString(ex))
12801280
errMsg += "Please be sure that you don't have any leftover characters (e.g. '[' or ']') "
12811281
errMsg += "in the hostname part"
12821282
raise SqlmapGenericException(errMsg)
@@ -1824,7 +1824,7 @@ def parseXmlFile(xmlFile, handler):
18241824
parse(stream, handler)
18251825
except (SAXParseException, UnicodeError), ex:
18261826
errMsg = "something seems to be wrong with "
1827-
errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, ex)
1827+
errMsg += "the file '%s' ('%s'). Please make " % (xmlFile, getSafeExString(ex))
18281828
errMsg += "sure that you haven't made any changes to it"
18291829
raise SqlmapInstallationException, errMsg
18301830

@@ -1885,7 +1885,7 @@ def readCachedFileContent(filename, mode='rb'):
18851885
kb.cache.content[filename] = f.read()
18861886
except (IOError, OSError, MemoryError), ex:
18871887
errMsg = "something went wrong while trying "
1888-
errMsg += "to read the content of file '%s' ('%s')" % (filename, ex)
1888+
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
18891889
raise SqlmapSystemException(errMsg)
18901890

18911891
return kb.cache.content[filename]
@@ -2004,7 +2004,7 @@ def getFileItems(filename, commentPrefix='#', unicode_=True, lowercase=False, un
20042004
retVal.append(line)
20052005
except (IOError, OSError, MemoryError), ex:
20062006
errMsg = "something went wrong while trying "
2007-
errMsg += "to read the content of file '%s' ('%s')" % (filename, ex)
2007+
errMsg += "to read the content of file '%s' ('%s')" % (filename, getSafeExString(ex))
20082008
raise SqlmapSystemException(errMsg)
20092009

20102010
return retVal if not unique else retVal.keys()

lib/core/option.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,7 @@ def _parseBurpLog(content):
341341
content = f.read()
342342
except (IOError, OSError, MemoryError), ex:
343343
errMsg = "something went wrong while trying "
344-
errMsg += "to read the content of file '%s' ('%s')" % (reqFile, ex)
344+
errMsg += "to read the content of file '%s' ('%s')" % (reqFile, getSafeExString(ex))
345345
raise SqlmapSystemException(errMsg)
346346

347347
if conf.scope:
@@ -386,7 +386,7 @@ def __contains__(self, name):
386386
tree.parse(paths.QUERIES_XML)
387387
except Exception, ex:
388388
errMsg = "something seems to be wrong with "
389-
errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, ex)
389+
errMsg += "the file '%s' ('%s'). Please make " % (paths.QUERIES_XML, getSafeExString(ex))
390390
errMsg += "sure that you haven't made any changes to it"
391391
raise SqlmapInstallationException, errMsg
392392

@@ -501,7 +501,7 @@ def _setCrawler():
501501
status = "%d/%d links visited (%d%%)" % (i + 1, len(targets), round(100.0 * (i + 1) / len(targets)))
502502
dataToStdout("\r[%s] [INFO] %s" % (time.strftime("%X"), status), True)
503503
except Exception, ex:
504-
errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, ex)
504+
errMsg = "problem occurred while crawling at '%s' ('%s')" % (target, getSafeExString(ex))
505505
logger.error(errMsg)
506506

507507
def _doSearch():
@@ -1098,7 +1098,7 @@ def _setHTTPHandlers():
10981098
try:
10991099
_ = urlparse.urlsplit(conf.proxy)
11001100
except Exception, ex:
1101-
errMsg = "invalid proxy address '%s' ('%s')" % (conf.proxy, ex)
1101+
errMsg = "invalid proxy address '%s' ('%s')" % (conf.proxy, getSafeExString(ex))
11021102
raise SqlmapSyntaxException, errMsg
11031103

11041104
hostnamePort = _.netloc.split(":")
@@ -2059,7 +2059,7 @@ def _saveConfig():
20592059
config.write(confFP)
20602060
except IOError, ex:
20612061
errMsg = "something went wrong while trying "
2062-
errMsg += "to write to the configuration file '%s' ('%s')" % (conf.saveConfig, ex)
2062+
errMsg += "to write to the configuration file '%s' ('%s')" % (conf.saveConfig, getSafeExString(ex))
20632063
raise SqlmapSystemException(errMsg)
20642064

20652065
infoMsg = "saved command line options to the configuration file '%s'" % conf.saveConfig
@@ -2368,14 +2368,14 @@ def _basicOptionValidation():
23682368
try:
23692369
re.compile(conf.regexp)
23702370
except re.error, ex:
2371-
errMsg = "invalid regular expression '%s' ('%s')" % (conf.regexp, ex)
2371+
errMsg = "invalid regular expression '%s' ('%s')" % (conf.regexp, getSafeExString(ex))
23722372
raise SqlmapSyntaxException(errMsg)
23732373

23742374
if conf.crawlExclude:
23752375
try:
23762376
re.compile(conf.crawlExclude)
23772377
except re.error, ex:
2378-
errMsg = "invalid regular expression '%s' ('%s')" % (conf.crawlExclude, ex)
2378+
errMsg = "invalid regular expression '%s' ('%s')" % (conf.crawlExclude, getSafeExString(ex))
23792379
raise SqlmapSyntaxException(errMsg)
23802380

23812381
if conf.dumpTable and conf.dumpAll:

lib/core/target.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
import urlparse
1515

1616
from lib.core.common import Backend
17+
from lib.core.common import getSafeExString
1718
from lib.core.common import getUnicode
1819
from lib.core.common import hashDBRetrieve
1920
from lib.core.common import intersect
@@ -658,7 +659,7 @@ def _createTargetDirs():
658659
errMsg = "you don't have enough permissions "
659660
else:
660661
errMsg = "something went wrong while trying "
661-
errMsg += "to write to the output directory '%s' (%s)" % (paths.SQLMAP_OUTPUT_PATH, ex)
662+
errMsg += "to write to the output directory '%s' (%s)" % (paths.SQLMAP_OUTPUT_PATH, getSafeExString(ex))
662663

663664
raise SqlmapMissingPrivileges(errMsg)
664665

lib/core/wordlist.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import os
99
import zipfile
1010

11+
from lib.core.common import getSafeExString
1112
from lib.core.exception import SqlmapDataException
1213
from lib.core.exception import SqlmapInstallationException
1314
from lib.core.settings import UNICODE_ENCODING
@@ -45,7 +46,7 @@ def adjust(self):
4546
_ = zipfile.ZipFile(self.current, 'r')
4647
except zipfile.error, ex:
4748
errMsg = "something seems to be wrong with "
48-
errMsg += "the file '%s' ('%s'). Please make " % (self.current, ex)
49+
errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex))
4950
errMsg += "sure that you haven't made any changes to it"
5051
raise SqlmapInstallationException, errMsg
5152
if len(_.namelist()) == 0:
@@ -71,7 +72,7 @@ def next(self):
7172
retVal = self.iter.next().rstrip()
7273
except zipfile.error, ex:
7374
errMsg = "something seems to be wrong with "
74-
errMsg += "the file '%s' ('%s'). Please make " % (self.current, ex)
75+
errMsg += "the file '%s' ('%s'). Please make " % (self.current, getSafeExString(ex))
7576
errMsg += "sure that you haven't made any changes to it"
7677
raise SqlmapInstallationException, errMsg
7778
except StopIteration:

lib/utils/hashdb.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def _get_cursor(self):
4141
connection.commit()
4242
except Exception, ex:
4343
errMsg = "error occurred while opening a session "
44-
errMsg += "file '%s' ('%s')" % (self.filepath, ex)
44+
errMsg += "file '%s' ('%s')" % (self.filepath, getSafeExString(ex))
4545
raise SqlmapDataException(errMsg)
4646

4747
return threadData.hashDBCursor
@@ -83,7 +83,7 @@ def retrieve(self, key, unserialize=False):
8383
if not "locked" in getSafeExString(ex):
8484
raise
8585
except sqlite3.DatabaseError, ex:
86-
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, ex)
86+
errMsg = "error occurred while accessing session file '%s' ('%s'). " % (self.filepath, getSafeExString(ex))
8787
errMsg += "If the problem persists please rerun with `--flush-session`"
8888
raise SqlmapDataException, errMsg
8989
else:

0 commit comments

Comments
 (0)