From 40365116bb43ff0808a8defb78d86a5d0cf86230 Mon Sep 17 00:00:00 2001 From: sthen Date: Thu, 12 Feb 2026 15:48:17 +0000 Subject: [PATCH] wfuzz: unbreak with py3.13, and use importlib.resources to avoid a large warning about pkg_resources being removed from setuptools. --- security/wfuzz/Makefile | 16 +++++----- ...ch-src_wfuzz_externals_reqresp_Response_py | 22 +++++++++++++ .../patch-src_wfuzz_helpers_file_func_py | 32 +++++++++++++++++++ 3 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 security/wfuzz/patches/patch-src_wfuzz_externals_reqresp_Response_py create mode 100644 security/wfuzz/patches/patch-src_wfuzz_helpers_file_func_py diff --git a/security/wfuzz/Makefile b/security/wfuzz/Makefile index f9f15e5abf9..df88264df11 100644 --- a/security/wfuzz/Makefile +++ b/security/wfuzz/Makefile @@ -2,7 +2,7 @@ COMMENT = web fuzzer MODPY_DISTV = 3.1.0 DISTNAME = wfuzz-${MODPY_DISTV} -REVISION = 6 +REVISION = 7 CATEGORIES = security www @@ -13,16 +13,16 @@ MAINTAINER = Sebastian Reitenbach # GPLv2 PERMIT_PACKAGE = Yes -MODPY_PI = Yes +MODPY_PI = Yes -MODULES = lang/python +MODULES = lang/python MODPY_PYBUILD = setuptools -RUN_DEPENDS = devel/py-parsing \ - devel/py-six \ - net/py-curl \ - textproc/py-chardet +RUN_DEPENDS = devel/py-parsing \ + devel/py-six \ + net/py-curl \ + textproc/py-chardet -BUILD_DEPENDS = ${RUN_DEPENDS} +#BUILD_DEPENDS = ${RUN_DEPENDS} .include diff --git a/security/wfuzz/patches/patch-src_wfuzz_externals_reqresp_Response_py b/security/wfuzz/patches/patch-src_wfuzz_externals_reqresp_Response_py new file mode 100644 index 00000000000..83b734076c2 --- /dev/null +++ b/security/wfuzz/patches/patch-src_wfuzz_externals_reqresp_Response_py @@ -0,0 +1,22 @@ +suggested replacement for removed API: +https://peps.python.org/pep-0594/#cgi + +Index: src/wfuzz/externals/reqresp/Response.py +--- src/wfuzz/externals/reqresp/Response.py.orig ++++ src/wfuzz/externals/reqresp/Response.py +@@ -1,5 +1,5 @@ + import re +-import cgi ++from email.message import Message + + from io import BytesIO + import gzip +@@ -22,7 +22,7 @@ def get_encoding_from_headers(headers): + if not content_type: + return None + +- content_type, params = cgi.parse_header(content_type) ++ content_type, params = Message(content_type) + + if "charset" in params: + return params["charset"].strip("'\"") diff --git a/security/wfuzz/patches/patch-src_wfuzz_helpers_file_func_py b/security/wfuzz/patches/patch-src_wfuzz_helpers_file_func_py new file mode 100644 index 00000000000..cff9fcac016 --- /dev/null +++ b/security/wfuzz/patches/patch-src_wfuzz_helpers_file_func_py @@ -0,0 +1,32 @@ +pkg_resources will go away + +Index: src/wfuzz/helpers/file_func.py +--- src/wfuzz/helpers/file_func.py.orig ++++ src/wfuzz/helpers/file_func.py +@@ -1,7 +1,6 @@ + import os + import sys + import re +-import pkg_resources + + from chardet.universaldetector import UniversalDetector + import chardet +@@ -10,15 +9,9 @@ from ..exception import FuzzExceptInternalError + + + def get_filter_help_file(): +- FILTER_HELP_FILE = "advanced.rst" +- FILTER_HELP_DEV_FILE = "../../../docs/user/advanced.rst" +- +- filter_help_text = None +- try: +- fname = pkg_resources.resource_filename("wfuzz", FILTER_HELP_FILE) +- filter_help_text = open(fname).read() +- except IOError: +- filter_help_text = open(get_path(FILTER_HELP_DEV_FILE)).read() ++ ref = importlib.resources.files('wfuzz') / 'advanced.rst' ++ with importlib.resources.as_file(ref) as path: ++ filter_help_text = open(path).read() + + return filter_help_text +