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

Skip to content

Commit e3ccf45

Browse files
committed
Graceful abort in case of an invalid configuration file
1 parent bcf754f commit e3ccf45

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

lib/parse/configfile.py

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

1010
from ConfigParser import MissingSectionHeaderError
11+
from ConfigParser import ParsingError
1112

1213
from lib.core.common import checkFile
1314
from lib.core.common import unArrayizeValue
@@ -64,8 +65,8 @@ def configFileParser(configFile):
6465
try:
6566
config = UnicodeRawConfigParser()
6667
config.readfp(configFP)
67-
except MissingSectionHeaderError:
68-
errMsg = "you have provided an invalid configuration file"
68+
except (MissingSectionHeaderError, ParsingError), ex:
69+
errMsg = "you have provided an invalid configuration file ('%s')" % str(ex)
6970
raise SqlmapSyntaxException(errMsg)
7071

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

0 commit comments

Comments
 (0)