Fixing CI/CD pipeline
Some checks failed
/ build (macos-latest, 3.8) (push) Has been cancelled
/ build (ubuntu-latest, pypy-2.7) (push) Has been cancelled
/ build (windows-latest, 3.14) (push) Has been cancelled

This commit is contained in:
Miroslav Štampar 2026-06-28 19:03:21 +02:00
parent 2297c81309
commit 4c869817d4
10 changed files with 41 additions and 22 deletions

View file

@ -455,6 +455,7 @@ class TestParseRequestFileBurp(unittest.TestCase):
self._method = conf.method
self._headers = conf.headers
conf.scope = None
conf.method = None # avoid a leaked conf.method overriding the parsed verb
def tearDown(self):
conf.scope = self._scope
@ -974,7 +975,7 @@ class TestGetPageWordSet(unittest.TestCase):
class TestNormalizeUnicode(unittest.TestCase):
def test_accents_stripped(self):
# normalizeUnicode collapses accented chars to their ASCII base
self.assertEqual(normalizeUnicode(u"éè"), "ee")
self.assertEqual(normalizeUnicode(u"\xe9\xe8"), "ee")
def test_plain_ascii_unchanged(self):
self.assertEqual(normalizeUnicode(u"abc123"), "abc123")
@ -1342,7 +1343,7 @@ class TestCommonDecodeIntToUnicode(unittest.TestCase):
from lib.core.common import decodeIntToUnicode
set_dbms(DBMS.PGSQL)
# value > 255 on PGSQL takes the _unichr(value) branch
self.assertEqual(decodeIntToUnicode(0x2122), u"")
self.assertEqual(decodeIntToUnicode(0x2122), u"\u2122")
class TestCommonDecodeDbmsHex(unittest.TestCase):

View file

@ -74,7 +74,10 @@ class TestCheckDependencies(unittest.TestCase):
def test_all_present_emits_all_installed_info(self):
# force every __import__ to succeed so no library is ever recorded as
# missing; the empty-missing-set branch must emit the summary info line.
import builtins
try:
import __builtin__ as builtins # py2 real builtin module
except ImportError:
import builtins # py3
class _FakeModule(object):
__version__ = "999.0.0"

View file

@ -153,7 +153,7 @@ class TestFingerprint(unittest.TestCase):
def test_fingerprint_extensive(self):
# conf.extensiveFp drives the deeper comment-/version-/dbms-check cascades
# (getFingerprint past the early return) much more code per dialect.
# (getFingerprint past the early return) - much more code per dialect.
# In this mode every dialect's output is built around an
# "active fingerprint: <Format.getDbms()>" line, so that header is the
# real content proof; the version "1.0" rides along for the ACTVER set.

View file

@ -328,6 +328,7 @@ class TestMisc(_GenericBase):
# An explicit Windows-style drive path flips Backend OS to Windows.
set_dbms("MySQL")
conf.tmpPath = "C:\\Temp"
kb.os = None # let getRemoteTempPath detect Windows from the drive path
m = _TestMisc()
out = m.getRemoteTempPath()
self.assertTrue(Backend.isOs(OS.WINDOWS))

View file

@ -30,7 +30,10 @@ from lib.utils import hash as H
from lib.core.data import conf, kb
from lib.core.enums import MKSTEMP_PREFIX
SCRATCH = "/tmp/claude-1000/-tmp-tmp-oUnlQJzlQN/fcd55d25-6313-49ed-817e-dcbe7fc2bf22/scratchpad"
import atexit
import shutil
SCRATCH = tempfile.mkdtemp(prefix="sqlmap_test_hashcrack_")
atexit.register(lambda: shutil.rmtree(SCRATCH, ignore_errors=True))
# known plaintext / hashes shared across tests
PW = "testpass"

View file

@ -208,7 +208,8 @@ def _drive_hpp(payload, name="id"):
kb.postSpaceToPlus = False
value = "%s=%s%s%s" % (name, PAYLOAD_DELIMITER, payload, PAYLOAD_DELIMITER)
try:
Connect.queryPage(value=value, place=PLACE.GET, disableTampering=True)
_qp = getattr(Connect.queryPage, "__func__", Connect.queryPage)
_qp(value=value, place=PLACE.GET, disableTampering=True)
except _Sentinel:
pass
finally:

View file

@ -75,7 +75,7 @@ class TestBasicDecodePage(unittest.TestCase):
def test_unicode_entity(self):
from lib.request.basic import decodePage
conf.encoding = None
self.assertEqual(decodePage(b"&#x2122;", None, "text/html; charset=utf-8"), u"")
self.assertEqual(decodePage(b"&#x2122;", None, "text/html; charset=utf-8"), u"\u2122")
def test_empty_page(self):
from lib.request.basic import decodePage

View file

@ -9,8 +9,6 @@ sqlmap for page content analysis. Exercises the parser with valid SGML/HTML
constructs and verifies the event stream.
"""
import contextlib
import io
import os
import sys
import unittest
@ -241,11 +239,23 @@ class TestVerbose(unittest.TestCase):
def _run(self, verbose):
p = self._Parser()
p.verbose = verbose
buf = io.StringIO()
with contextlib.redirect_stdout(buf):
_captured = []
class _Cap(object):
def write(self, s):
_captured.append(s)
def flush(self):
pass
_saved = sys.stdout
sys.stdout = _Cap()
try:
p.feed("</b>") # unbalanced end tag -> report_unbalanced()
p.close()
return buf.getvalue()
finally:
sys.stdout = _saved
return "".join(_captured)
def test_verbose_mode_emits_debug(self):
out = self._run(1)