Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 148b35d

Browse files
committed
Better extraction of absolute file paths
1 parent 3865b3a commit 148b35d

2 files changed

Lines changed: 6 additions & 2 deletions

File tree

lib/core/common.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@
103103
from lib.core.settings import DUMMY_USER_INJECTION
104104
from lib.core.settings import DYNAMICITY_MARK_LENGTH
105105
from lib.core.settings import ERROR_PARSING_REGEXES
106+
from lib.core.settings import FILE_PATH_REGEXES
106107
from lib.core.settings import FORCE_COOKIE_EXPIRATION_TIME
107108
from lib.core.settings import FORM_SEARCH_REGEX
108109
from lib.core.settings import GENERIC_DOC_ROOT_DIRECTORY_NAMES
@@ -1533,7 +1534,7 @@ def parseFilePaths(page):
15331534
"""
15341535

15351536
if page:
1536-
for regex in (r" in <b>(?P<result>.*?)</b> on line", r"(?:>|\s)(?P<result>[A-Za-z]:[\\/][\w.\\/]*)", r"(?:>|\s)(?P<result>/\w[/\w.]+)"):
1537+
for regex in FILE_PATH_REGEXES:
15371538
for match in re.finditer(regex, page):
15381539
absFilePath = match.group("result").strip()
15391540
page = page.replace(absFilePath, "")

lib/core/settings.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
from lib.core.revision import getRevisionNumber
2020

2121
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
22-
VERSION = "1.0.5.66"
22+
VERSION = "1.0.5.67"
2323
REVISION = getRevisionNumber()
2424
STABLE = VERSION.count('.') <= 2
2525
VERSION_STRING = "sqlmap/%s#%s" % (VERSION, "stable" if STABLE else "dev")
@@ -284,6 +284,9 @@
284284
# String representation for current database
285285
CURRENT_DB = "CD"
286286

287+
# Regular expressions used for finding file paths in error messages
288+
FILE_PATH_REGEXES = (r" in (file )?<b>(?P<result>.*?)</b> on line", r"(?:>|\s)(?P<result>[A-Za-z]:[\\/][\w.\\/-]*)", r"(?:>|\s)(?P<result>/\w[/\w.-]+)")
289+
287290
# Regular expressions used for parsing error messages (--parse-errors)
288291
ERROR_PARSING_REGEXES = (
289292
r"<b>[^<]*(fatal|error|warning|exception)[^<]*</b>:?\s*(?P<result>.+?)<br\s*/?\s*>",

0 commit comments

Comments
 (0)