From 148b35da4f339aee8cdde11465ce7e3988ab245d Mon Sep 17 00:00:00 2001 From: Miroslav Stampar Date: Wed, 25 May 2016 15:29:25 +0200 Subject: [PATCH] Better extraction of absolute file paths --- lib/core/common.py | 3 ++- lib/core/settings.py | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/core/common.py b/lib/core/common.py index 11bf1e42e..b19515129 100644 --- a/lib/core/common.py +++ b/lib/core/common.py @@ -103,6 +103,7 @@ from lib.core.settings import DEFAULT_MSSQL_SCHEMA from lib.core.settings import DUMMY_USER_INJECTION from lib.core.settings import DYNAMICITY_MARK_LENGTH from lib.core.settings import ERROR_PARSING_REGEXES +from lib.core.settings import FILE_PATH_REGEXES from lib.core.settings import FORCE_COOKIE_EXPIRATION_TIME from lib.core.settings import FORM_SEARCH_REGEX from lib.core.settings import GENERIC_DOC_ROOT_DIRECTORY_NAMES @@ -1533,7 +1534,7 @@ def parseFilePaths(page): """ if page: - for regex in (r" in (?P.*?) on line", r"(?:>|\s)(?P[A-Za-z]:[\\/][\w.\\/]*)", r"(?:>|\s)(?P/\w[/\w.]+)"): + for regex in FILE_PATH_REGEXES: for match in re.finditer(regex, page): absFilePath = match.group("result").strip() page = page.replace(absFilePath, "") diff --git a/lib/core/settings.py b/lib/core/settings.py index 709851bf2..7c44726a1 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.66" +VERSION = "1.0.5.67" REVISION = getRevisionNumber() STABLE = VERSION.count('.') <= 2 VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev") @@ -284,6 +284,9 @@ BLANK = "" # String representation for current database CURRENT_DB = "CD" +# Regular expressions used for finding file paths in error messages +FILE_PATH_REGEXES = (r" in (file )?(?P.*?) on line", r"(?:>|\s)(?P[A-Za-z]:[\\/][\w.\\/-]*)", r"(?:>|\s)(?P/\w[/\w.-]+)") + # Regular expressions used for parsing error messages (--parse-errors) ERROR_PARSING_REGEXES = ( r"[^<]*(fatal|error|warning|exception)[^<]*:?\s*(?P.+?)",