Minor fix

This commit is contained in:
Miroslav Štampar 2026-07-19 12:12:26 +02:00
parent 00cccf78e5
commit e288df23db
2 changed files with 16 additions and 2 deletions

View file

@ -20,7 +20,7 @@ from lib.core.enums import OS
from thirdparty import six
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
VERSION = "1.10.7.121"
VERSION = "1.10.7.122"
TYPE = "dev" if VERSION.count('.') > 2 and VERSION.split('.')[-1] != '0' else "stable"
TYPE_COLORS = {"dev": 33, "stable": 90, "pip": 34}
VERSION_STRING = "sqlmap/%s#%s" % ('.'.join(VERSION.split('.')[:-1]) if VERSION.count('.') > 2 and VERSION.split('.')[-1] == '0' else VERSION, TYPE)
@ -481,7 +481,7 @@ CURRENT_USER = "CU"
SESSION_SQLITE_FILE = "session.sqlite"
# Regular expressions used for finding file paths in error messages
FILE_PATH_REGEXES = (r"<b>(?P<result>[^<>]+?)</b> on line \d+", r"\bin (?P<result>[^<>'\"]+?)['\"]? on line \d+", r"(?:[>(\[\s])(?P<result>[A-Za-z]:[\\/][\w. \\/-]*)", r"(?:[>(\[\s])(?P<result>/\w[/\w.~-]+)", r"\bhref=['\"]file://(?P<result>/[^'\"]+)", r"\bin <b>(?P<result>[^<]+): line \d+")
FILE_PATH_REGEXES = (r"<b>(?P<result>[^<>]+?)</b> on line \d+", r"\bin (?P<result>[^<>'\"]+?)['\"]? on line \d+", r"(?:[>(\[\s'\"])(?P<result>[A-Za-z]:[\\/][\w. \\/-]*)", r"(?:[>(\[\s'\"])(?P<result>/\w[/\w.~-]+)", r"\bhref=['\"]file://(?P<result>/[^'\"]+)", r"\bin <b>(?P<result>[^<]+): line \d+")
# Regular expressions used for parsing error messages (--parse-errors)
ERROR_PARSING_REGEXES = (

View file

@ -61,6 +61,20 @@ class TestParseFilePaths(unittest.TestCase):
self.assertIn("C:\\inetpub\\wwwroot\\app\\index.asp", kb.absFilePaths,
msg="windows path not harvested in full: %s" % kb.absFilePaths)
def test_quoted_paths_harvested(self):
# paths delimited by a leading quote (Python/Java/.NET stack traces) must be harvested too
parseFilePaths('File "/usr/lib/python3.11/site-packages/app.py", line 10')
parseFilePaths("Cannot read '/opt/tomcat/webapps/app/WEB-INF/web.xml' now")
parseFilePaths('Could not find file "C:\\data\\config.ini".')
self.assertIn("/usr/lib/python3.11/site-packages/app.py", kb.absFilePaths)
self.assertIn("/opt/tomcat/webapps/app/WEB-INF/web.xml", kb.absFilePaths)
self.assertIn("C:\\data\\config.ini", kb.absFilePaths)
def test_quoted_non_path_ignored(self):
# a leading quote must not turn ordinary quoted words or URLs into "paths"
parseFilePaths("error: 'foobar' invalid; see 'https://example.com/help' for info")
self.assertEqual(kb.absFilePaths, set())
class TestGetSafeExString(unittest.TestCase):
def test_format(self):