From a90913c57d79aec7df1bed1e1223bf541845b93c Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Tue, 23 Feb 2016 11:46:04 +0100 Subject: [PATCH] Proper patch for #1723 --- lib/core/option.py | 1 - lib/parse/configfile.py | 17 ++++++++--------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/core/option.py b/lib/core/option.py index e50075e52..ad3b590ff 100644 --- a/lib/core/option.py +++ b/lib/core/option.py @@ -2165,7 +2165,6 @@ def _mergeOptions(inputOptions, overrideOptions): if hasattr(conf, key) and conf[key] is None: conf[key] = value - lut = {} for group in optDict.keys(): lut.update((_.upper(), _) for _ in optDict[group]) diff --git a/lib/parse/configfile.py b/lib/parse/configfile.py index 9a3e3e311..ef6807b72 100644 --- a/lib/parse/configfile.py +++ b/lib/parse/configfile.py @@ -11,6 +11,7 @@ from lib.core.common import getUnicode from lib.core.common import openFile from lib.core.common import unArrayizeValue from lib.core.common import UnicodeRawConfigParser +from lib.core.data import cmdLineOptions from lib.core.data import conf from lib.core.data import logger from lib.core.exception import SqlmapMissingMandatoryOptionException @@ -75,16 +76,14 @@ def configFileParser(configFile): errMsg = "missing a mandatory section 'Target' in the configuration file" raise SqlmapMissingMandatoryOptionException(errMsg) - condition = not config.has_option("Target", "direct") - condition &= not config.has_option("Target", "url") - condition &= not config.has_option("Target", "logFile") - condition &= not config.has_option("Target", "bulkFile") - condition &= not config.has_option("Target", "googleDork") - condition &= not config.has_option("Target", "requestFile") - condition &= not config.has_option("Target", "sitemapUrl") - condition &= not config.has_option("Target", "wizard") + mandatory = False - if condition: + for option in ("direct", "url", "logFile", "bulkFile", "googleDork", "requestFile", "sitemapUrl", "wizard"): + if config.has_option("Target", option) and config.get("Target", option) or cmdLineOptions.get(option): + mandatory = True + break + + if not mandatory: errMsg = "missing a mandatory option in the configuration file " errMsg += "(direct, url, logFile, bulkFile, googleDork, requestFile, sitemapUrl or wizard)" raise SqlmapMissingMandatoryOptionException(errMsg)