From b965e5bf1c5d24f7971792ac87025f9a1581172f Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Mon, 30 May 2016 16:06:39 +0200 Subject: [PATCH] Minor refactoring --- lib/controller/checks.py | 3 ++- lib/core/settings.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/controller/checks.py b/lib/controller/checks.py index 39660830d..d8a477cc1 100644 --- a/lib/controller/checks.py +++ b/lib/controller/checks.py @@ -66,6 +66,7 @@ from lib.core.exception import SqlmapSilentQuitException from lib.core.exception import SqlmapUserQuitException from lib.core.settings import DEFAULT_GET_POST_DELIMITER from lib.core.settings import DUMMY_NON_SQLI_CHECK_APPENDIX +from lib.core.settings import FI_ERROR_REGEX from lib.core.settings import FORMAT_EXCEPTION_STRINGS from lib.core.settings import HEURISTIC_CHECK_ALPHABET from lib.core.settings import IDS_WAF_CHECK_PAYLOAD @@ -960,7 +961,7 @@ def heuristicCheckSqlInjection(place, parameter): infoMsg += "'%s' might be vulnerable to cross-site scripting attacks" % parameter logger.info(infoMsg) - for match in re.finditer("(?i)[^\n]*(no such file|failed (to )?open)[^\n]*", page or ""): + for match in re.finditer(FI_ERROR_REGEX, page or ""): if randStr1.lower() in match.group(0).lower(): infoMsg = "heuristic (FI) test shows that %s parameter " % paramType infoMsg += "'%s' might be vulnerable to file inclusion attacks" % parameter diff --git a/lib/core/settings.py b/lib/core/settings.py index 67cbea3ab..27de65ddf 100644 --- a/lib/core/settings.py +++ b/lib/core/settings.py @@ -19,7 +19,7 @@ from lib.core.enums import OS from lib.core.revision import getRevisionNumber # sqlmap version (...) -VERSION = "1.0.5.109" +VERSION = "1.0.5.110" REVISION = getRevisionNumber() STABLE = VERSION.count('.') <= 2 VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev") @@ -565,6 +565,9 @@ HEURISTIC_CHECK_ALPHABET = ('"', '\'', ')', '(', ',', '.') # String used for dummy non-SQLi (e.g. XSS) heuristic checks of a tested parameter value DUMMY_NON_SQLI_CHECK_APPENDIX = "<'\">" +# Regular expression used for recognition of file inclusion errors +FI_ERROR_REGEX = "(?i)[^\n]*(no such file|failed (to )?open)[^\n]*" + # Length of prefix and suffix used in non-SQLI heuristic checks NON_SQLI_CHECK_PREFIX_SUFFIX_LENGTH = 6