mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2025-02-02 20:54:13 +03:00
Implementation for an Issue #678
This commit is contained in:
parent
efa3c3e451
commit
ae8b1fe89c
|
@ -179,6 +179,12 @@ class EXPECTED:
|
||||||
BOOL = "bool"
|
BOOL = "bool"
|
||||||
INT = "int"
|
INT = "int"
|
||||||
|
|
||||||
|
class OPTION_TYPE:
|
||||||
|
BOOLEAN = "boolean"
|
||||||
|
INTEGER = "integer"
|
||||||
|
FLOAT = "float"
|
||||||
|
STRING = "string"
|
||||||
|
|
||||||
class HASHDB_KEYS:
|
class HASHDB_KEYS:
|
||||||
DBMS = "DBMS"
|
DBMS = "DBMS"
|
||||||
CONF_TMP_PATH = "CONF_TMP_PATH"
|
CONF_TMP_PATH = "CONF_TMP_PATH"
|
||||||
|
|
|
@ -75,6 +75,7 @@ from lib.core.enums import DUMP_FORMAT
|
||||||
from lib.core.enums import HTTP_HEADER
|
from lib.core.enums import HTTP_HEADER
|
||||||
from lib.core.enums import HTTPMETHOD
|
from lib.core.enums import HTTPMETHOD
|
||||||
from lib.core.enums import MOBILES
|
from lib.core.enums import MOBILES
|
||||||
|
from lib.core.enums import OPTION_TYPE
|
||||||
from lib.core.enums import PAYLOAD
|
from lib.core.enums import PAYLOAD
|
||||||
from lib.core.enums import PRIORITY
|
from lib.core.enums import PRIORITY
|
||||||
from lib.core.enums import PROXY_TYPE
|
from lib.core.enums import PROXY_TYPE
|
||||||
|
@ -120,6 +121,7 @@ from lib.core.settings import PGSQL_ALIASES
|
||||||
from lib.core.settings import PROBLEMATIC_CUSTOM_INJECTION_PATTERNS
|
from lib.core.settings import PROBLEMATIC_CUSTOM_INJECTION_PATTERNS
|
||||||
from lib.core.settings import SITE
|
from lib.core.settings import SITE
|
||||||
from lib.core.settings import SQLITE_ALIASES
|
from lib.core.settings import SQLITE_ALIASES
|
||||||
|
from lib.core.settings import SQLMAP_ENVIRONMENT_PREFIX
|
||||||
from lib.core.settings import SUPPORTED_DBMS
|
from lib.core.settings import SUPPORTED_DBMS
|
||||||
from lib.core.settings import SUPPORTED_OS
|
from lib.core.settings import SUPPORTED_OS
|
||||||
from lib.core.settings import SYBASE_ALIASES
|
from lib.core.settings import SYBASE_ALIASES
|
||||||
|
@ -1823,16 +1825,16 @@ def _saveCmdline():
|
||||||
datatype = datatype[0]
|
datatype = datatype[0]
|
||||||
|
|
||||||
if value is None:
|
if value is None:
|
||||||
if datatype == "boolean":
|
if datatype == OPTION_TYPE.BOOLEAN:
|
||||||
value = "False"
|
value = "False"
|
||||||
elif datatype in ("integer", "float"):
|
elif datatype in (OPTION_TYPE.INTEGER, OPTION_TYPE.FLOAT):
|
||||||
if option in ("threads", "verbose"):
|
if option in ("threads", "verbose"):
|
||||||
value = "1"
|
value = "1"
|
||||||
elif option == "timeout":
|
elif option == "timeout":
|
||||||
value = "10"
|
value = "10"
|
||||||
else:
|
else:
|
||||||
value = "0"
|
value = "0"
|
||||||
elif datatype == "string":
|
elif datatype == OPTION_TYPE.STRING:
|
||||||
value = ""
|
value = ""
|
||||||
|
|
||||||
if isinstance(value, basestring):
|
if isinstance(value, basestring):
|
||||||
|
@ -1903,6 +1905,37 @@ def _mergeOptions(inputOptions, overrideOptions):
|
||||||
if hasattr(conf, key) and conf[key] is None:
|
if hasattr(conf, key) and conf[key] is None:
|
||||||
conf[key] = value
|
conf[key] = value
|
||||||
|
|
||||||
|
_ = {}
|
||||||
|
for key, value in os.environ.items():
|
||||||
|
if key.upper().startswith(SQLMAP_ENVIRONMENT_PREFIX):
|
||||||
|
_[key[len(SQLMAP_ENVIRONMENT_PREFIX):].upper()] = value
|
||||||
|
|
||||||
|
types_ = {}
|
||||||
|
for group in optDict.keys():
|
||||||
|
types_.update(optDict[group])
|
||||||
|
|
||||||
|
for key in conf:
|
||||||
|
if key.upper() in _:
|
||||||
|
value = _[key.upper()]
|
||||||
|
|
||||||
|
if types_[key] == OPTION_TYPE.BOOLEAN:
|
||||||
|
try:
|
||||||
|
value = bool(value)
|
||||||
|
except ValueError:
|
||||||
|
value = False
|
||||||
|
elif types_[key] == OPTION_TYPE.INTEGER:
|
||||||
|
try:
|
||||||
|
value = int(value)
|
||||||
|
except ValueError:
|
||||||
|
value = 0
|
||||||
|
elif types_[key] == OPTION_TYPE.FLOAT:
|
||||||
|
try:
|
||||||
|
value = float(value)
|
||||||
|
except ValueError:
|
||||||
|
value = 0.0
|
||||||
|
|
||||||
|
conf[key] = value
|
||||||
|
|
||||||
mergedOptions.update(conf)
|
mergedOptions.update(conf)
|
||||||
|
|
||||||
def _setTrafficOutputFP():
|
def _setTrafficOutputFP():
|
||||||
|
|
|
@ -346,6 +346,9 @@ ASP_NET_CONTROL_REGEX = r"(?i)\Actl\d+\$"
|
||||||
# Prefix for Google analytics cookie names
|
# Prefix for Google analytics cookie names
|
||||||
GOOGLE_ANALYTICS_COOKIE_PREFIX = "__UTM"
|
GOOGLE_ANALYTICS_COOKIE_PREFIX = "__UTM"
|
||||||
|
|
||||||
|
# Prefix for configuration overriding environment variables
|
||||||
|
SQLMAP_ENVIRONMENT_PREFIX = "SQLMAP_"
|
||||||
|
|
||||||
# Turn off resume console info to avoid potential slowdowns
|
# Turn off resume console info to avoid potential slowdowns
|
||||||
TURN_OFF_RESUME_INFO_LIMIT = 20
|
TURN_OFF_RESUME_INFO_LIMIT = 20
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user