wfuzz: unbreak with py3.13, and use importlib.resources to avoid a large

warning about pkg_resources being removed from setuptools.
This commit is contained in:
sthen
2026-02-12 15:48:17 +00:00
parent c286dc8091
commit 40365116bb
3 changed files with 62 additions and 8 deletions
+8 -8
View File
@@ -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 <sebastia@openbsd.org>
# 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 <bsd.port.mk>
@@ -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("'\"")
@@ -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