Graceful abort in case of an invalid configuration file

This commit is contained in:
Miroslav Stampar 2014-04-07 20:17:47 +02:00
parent bcf754fb17
commit e3ccf45503

View File

@ -8,6 +8,7 @@ See the file 'doc/COPYING' for copying permission
import codecs import codecs
from ConfigParser import MissingSectionHeaderError from ConfigParser import MissingSectionHeaderError
from ConfigParser import ParsingError
from lib.core.common import checkFile from lib.core.common import checkFile
from lib.core.common import unArrayizeValue from lib.core.common import unArrayizeValue
@ -64,8 +65,8 @@ def configFileParser(configFile):
try: try:
config = UnicodeRawConfigParser() config = UnicodeRawConfigParser()
config.readfp(configFP) config.readfp(configFP)
except MissingSectionHeaderError: except (MissingSectionHeaderError, ParsingError), ex:
errMsg = "you have provided an invalid configuration file" errMsg = "you have provided an invalid configuration file ('%s')" % str(ex)
raise SqlmapSyntaxException(errMsg) raise SqlmapSyntaxException(errMsg)
if not config.has_section("Target"): if not config.has_section("Target"):