mirror of
https://github.com/sqlmapproject/sqlmap.git
synced 2026-10-11 22:19:55 +00:00
Fixes #6137
This commit is contained in:
@@ -20,7 +20,7 @@ from lib.core.enums import OS
|
||||
from thirdparty import six
|
||||
|
||||
# sqlmap version (<major>.<minor>.<month>.<monthly commit>)
|
||||
VERSION = "1.10.9.32"
|
||||
VERSION = "1.10.10.0"
|
||||
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)
|
||||
|
||||
+5
-1
@@ -561,7 +561,11 @@ def _resumeDBMS():
|
||||
dbms = value.lower()
|
||||
dbmsVersion = [UNKNOWN_DBMS_VERSION]
|
||||
_ = "(%s)" % ('|'.join(SUPPORTED_DBMS))
|
||||
_ = re.search(r"\A%s (.*)" % _, dbms, re.I)
|
||||
try:
|
||||
# Dirty patch for a Python 3.13/3.14 re module regression (e.g. https://github.com/sqlmapproject/sqlmap/issues/6128, https://github.com/sqlmapproject/sqlmap/issues/6137)
|
||||
_ = re.search(r"\A%s (.*)" % _, dbms, re.I)
|
||||
except TypeError:
|
||||
_ = None
|
||||
|
||||
if _:
|
||||
dbms = _.group(1).lower()
|
||||
|
||||
@@ -51,6 +51,7 @@ from lib.core.settings import RESTORE_MERGED_OPTIONS
|
||||
from lib.core.settings import UNENCODED_ORIGINAL_VALUE
|
||||
from lib.core.threads import getCurrentThreadData
|
||||
from lib.utils.hashdb import HashDB
|
||||
import lib.core.target as target
|
||||
from lib.core.target import _createDumpDir
|
||||
from lib.core.target import _createFilesDir
|
||||
from lib.core.target import _createTargetDirs
|
||||
@@ -354,6 +355,31 @@ class TestResumeDBMS(_TargetTestBase):
|
||||
with self.assertRaises(SqlmapNoneDataException):
|
||||
_resumeDBMS()
|
||||
|
||||
def test_survives_broken_re_module(self):
|
||||
# a Python 3.13/3.14 're' module regression can make re.search() raise TypeError on an
|
||||
# otherwise-valid pattern (#6128, #6137) - must fall back to "no match" (the stored value
|
||||
# used as-is) instead of crashing the whole resume
|
||||
self._new_hashdb()
|
||||
conf.dbms = None
|
||||
conf.offline = False
|
||||
hashDBWrite(HASHDB_KEYS.DBMS, "MySQL 5.0")
|
||||
|
||||
originalRe = target.re
|
||||
|
||||
class _BrokenRe(object):
|
||||
I = originalRe.I
|
||||
|
||||
def search(self, *args, **kwargs):
|
||||
raise TypeError("list.append() takes exactly one argument (2 given)")
|
||||
|
||||
target.re = _BrokenRe()
|
||||
try:
|
||||
_resumeDBMS()
|
||||
finally:
|
||||
target.re = originalRe
|
||||
|
||||
self.assertIsNone(Backend.getIdentifiedDbms())
|
||||
|
||||
|
||||
class TestResumeOS(_TargetTestBase):
|
||||
def test_resumes_os(self):
|
||||
|
||||
Reference in New Issue
Block a user