Parse configuration file and save settings into the configuration advanced dictionary.
(section, option, datatype)
| 22 | config = None |
| 23 | |
| 24 | def configFileProxy(section, option, datatype): |
| 25 | """ |
| 26 | Parse configuration file and save settings into the configuration |
| 27 | advanced dictionary. |
| 28 | """ |
| 29 | |
| 30 | if config.has_option(section, option): |
| 31 | try: |
| 32 | if datatype == OPTION_TYPE.BOOLEAN: |
| 33 | value = config.getboolean(section, option) if config.get(section, option) else False |
| 34 | elif datatype == OPTION_TYPE.INTEGER: |
| 35 | value = config.getint(section, option) if config.get(section, option) else 0 |
| 36 | elif datatype == OPTION_TYPE.FLOAT: |
| 37 | value = config.getfloat(section, option) if config.get(section, option) else 0.0 |
| 38 | else: |
| 39 | value = config.get(section, option) |
| 40 | except ValueError as ex: |
| 41 | errMsg = "error occurred while processing the option " |
| 42 | errMsg += "'%s' in provided configuration file ('%s')" % (option, getUnicode(ex)) |
| 43 | raise SqlmapSyntaxException(errMsg) |
| 44 | |
| 45 | if value: |
| 46 | conf[option] = value |
| 47 | else: |
| 48 | conf[option] = None |
| 49 | else: |
| 50 | debugMsg = "missing requested option '%s' (section " % option |
| 51 | debugMsg += "'%s') into the configuration file, " % section |
| 52 | debugMsg += "ignoring. Skipping to next." |
| 53 | logger.debug(debugMsg) |
| 54 | |
| 55 | def configFileParser(configFile): |
| 56 | """ |
no test coverage detected
searching dependent graphs…