Tuesday, March 03, 2026

Re: ports libpcap?

On 2026/02/27 14:04, Sebastian Reitenbach wrote:
> Hi,
>
> I forgot what I wanted to port or update some loong time ago, and indeed ran into this timeval
> vs. bpf_timeval issue that caused grief. 
> Don't remember if I gave up, or was able to figure it out ;)
> Therefore definitely would appreciate a libpcap in ports.
>
> lightly tested, works for me on amd64. 
>
> I agree with Kirill, using libepacp everywhere would be more intuitive.
>
> Sebastian
>
>
> On Fri, Feb 27, 2026 at 1:22 AM Kirill A. Korinsky <kirill@korins.ky> wrote:
>
> On Fri, 27 Feb 2026 00:07:17 +0100,
> Stuart Henderson <stu@spacehopper.org> wrote:
> >
> > [1  <text/plain; us-ascii (8bit)>]
> > that was intentional, it's in a non standard directory (similar layout
> > to ports/security/openssl, though I've just realised that moving the
> > manpages may be a good idea).
> >
>
> ... and the only way to get it is asking pkgconfig for libepcap
>
> Well, it seems to work, but I still think that name it libepcap everywhere
> is cleaner.

here goes. on the one hand, renaming the library makes it significantly
more hassle to patch ports to use it, on the other it no longer needs to
go in a subdir so no more rpath, and "make port-lib-depends-check" works.

updated version of the libpcap port attached, and diff for wireshark and
a bonus one for nmap (including an update) to use it.

(+CC nmap maintainer, any feedback?).

further notes on the nmap update:

- this takes it into a version using the NPSL; newer versions of the
annotated license have clarified thing that i had an issue with before;
i have concluded that this is no longer a blocker as far as ports goes.
(i see that debian have too, and they're usually as fussy as me ;)

- i switched from a "single multipackage" port to a standard port,
deps need revision bumps (net/librenms net/py-nmap net/p5-Nmap-Scanner
net/p5-Nmap-Parser)

Index: net/wireshark/Makefile
===================================================================
RCS file: /cvs/ports/net/wireshark/Makefile,v
diff -u -p -r1.176 Makefile
--- net/wireshark/Makefile 26 Feb 2026 10:21:38 -0000 1.176
+++ net/wireshark/Makefile 3 Mar 2026 20:41:01 -0000
@@ -4,19 +4,15 @@ COMMENT-main = graphical network protoco
COMMENT-text = network protocol analyzer

DPB_PROPERTIES = parallel
-V = 4.4.14
-PORTROACH = limit:^4\.4\.
-#PORTROACH = limitw:1,even # 4.6 needs newer libpcap
+V = 4.6.4
+PORTROACH = limitw:1,even
DISTNAME = wireshark-$V
PKGNAME-main = wireshark-$V
PKGNAME-text = tshark-$V

-# keep above 7.8-stable
-REVISION = 0
-
-SHARED_LIBS += wsutil 4.0
-SHARED_LIBS += wiretap 4.0
-SHARED_LIBS += wireshark 4.0
+SHARED_LIBS += wsutil 5.0
+SHARED_LIBS += wiretap 5.0
+SHARED_LIBS += wireshark 5.0

CATEGORIES = net security x11

@@ -51,12 +47,12 @@ MODLUA_SA = Yes
MODLUA_RUNDEP = No
MODPY_RUNDEP = No

-cWANTLIB += c gcrypt glib-2.0 m pcap speexdsp
+cWANTLIB += c epcap gcrypt glib-2.0 m speexdsp

WANTLIB-text = ${cWANTLIB} ${MODLUA_WANTLIB}
WANTLIB-text += bcg729 brotlidec cares gmodule-2.0 gnutls lz4 maxminddb
WANTLIB-text += nghttp2 nghttp3 opencore-amrnb opus pcre2-8 smi snappy
-WANTLIB-text += spandsp ssh xml2 z zstd
+WANTLIB-text += spandsp ssh xml2 xxhash z zstd

WANTLIB-main = ${cWANTLIB} ${COMPILER_LIBCXX}
WANTLIB-main += minizip wireshark wiretap wsutil
@@ -92,10 +88,12 @@ LIB_DEPENDS-text = ${MODLUA_LIB_DEPENDS}
devel/pcre2 \
net/libcares \
net/libmaxminddb \
+ net/libpcap \
net/libsmi \
security/gnutls \
security/libgcrypt \
security/libssh \
+ sysutils/xxhash \
telephony/bcg729 \
telephony/spandsp \
textproc/libxml \
Index: net/wireshark/distinfo
===================================================================
RCS file: /cvs/ports/net/wireshark/distinfo,v
diff -u -p -r1.110 distinfo
--- net/wireshark/distinfo 26 Feb 2026 10:21:38 -0000 1.110
+++ net/wireshark/distinfo 3 Mar 2026 20:41:01 -0000
@@ -1,2 +1,2 @@
-SHA256 (wireshark-4.4.14.tar.xz) = yRExML0rN5Gf3PV19xBGnOORlguq/zGRHjKIRp5qjo0=
-SIZE (wireshark-4.4.14.tar.xz) = 46874836
+SHA256 (wireshark-4.6.4.tar.xz) = ++qz2FxsildjyNm3/iC1xpyp+efyuCS+3HMTW9yjMuI=
+SIZE (wireshark-4.6.4.tar.xz) = 50566640
Index: net/wireshark/patches/patch-CMakeLists_txt
===================================================================
RCS file: net/wireshark/patches/patch-CMakeLists_txt
diff -N net/wireshark/patches/patch-CMakeLists_txt
--- net/wireshark/patches/patch-CMakeLists_txt 20 Feb 2025 16:09:51 -0000 1.24
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,16 +0,0 @@
-Avoid the broken libwsutil.so that gets generated with -pie -shared
-(probably following tools/clang/lib/Driver/Tools.cpp r1.13 "push back
--pie to the linker if -pie is specified").
-
-Index: CMakeLists.txt
---- CMakeLists.txt.orig
-+++ CMakeLists.txt
-@@ -1173,7 +1173,7 @@ endif()
-
- include(CheckCLinkerFlag)
-
--if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC" AND NOT OSS_FUZZ)
-+if(NOT CMAKE_C_COMPILER_ID MATCHES "MSVC" AND NOT OSS_FUZZ AND NOT CMAKE_SYSTEM_NAME STREQUAL OpenBSD)
- #
- # The -pie linker option produces a position-independent executable.
- # Some Linux distributions have this enabled by default in the compiler,
Index: net/wireshark/patches/patch-capture_capture-pcap-util_c
===================================================================
RCS file: /cvs/ports/net/wireshark/patches/patch-capture_capture-pcap-util_c,v
diff -u -p -r1.6 patch-capture_capture-pcap-util_c
--- net/wireshark/patches/patch-capture_capture-pcap-util_c 29 Aug 2024 08:12:27 -0000 1.6
+++ net/wireshark/patches/patch-capture_capture-pcap-util_c 3 Mar 2026 20:41:01 -0000
@@ -1,4 +1,4 @@
-hunks 1/2: ioctl is needed on !linux
+hunks 1/2: ioctl is needed on !linux too

hunk 3: pcap_findalldevs() doesn't include controllers dumpable via
usbpcap, do a separate lookup and add to the list
@@ -17,14 +17,14 @@ Index: capture/capture-pcap-util.c
/*
@@ -44,8 +46,6 @@
*/
- #if defined(HAVE_PCAP_CREATE) && defined(__linux__)
+ #if defined(__linux__)

-#include <sys/ioctl.h>
-
/*
* If we're building for a Linux version that supports bonding,
* HAVE_BONDING will be defined.
-@@ -817,6 +817,23 @@ get_interface_list_findalldevs(int *err, char **err_st
+@@ -816,6 +816,23 @@ get_interface_list_findalldevs(int *err, char **err_st
if_info_ip(if_info, dev);
}
pcap_freealldevs(alldevs);
Index: net/wireshark/patches/patch-cmake_modules_FindPCAP_cmake
===================================================================
RCS file: net/wireshark/patches/patch-cmake_modules_FindPCAP_cmake
diff -N net/wireshark/patches/patch-cmake_modules_FindPCAP_cmake
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ net/wireshark/patches/patch-cmake_modules_FindPCAP_cmake 3 Mar 2026 20:41:01 -0000
@@ -0,0 +1,42 @@
+- use ports libpcap
+
+Index: cmake/modules/FindPCAP.cmake
+--- cmake/modules/FindPCAP.cmake.orig
++++ cmake/modules/FindPCAP.cmake
+@@ -14,7 +14,7 @@ FindWSWinLibs("libpcap-*" "PCAP_HINTS")
+ #
+ if(NOT USE_REPOSITORY)
+ find_package(PkgConfig)
+- pkg_search_module(PC_PCAP libpcap)
++ pkg_search_module(PC_PCAP libepcap)
+ endif()
+
+ if(NOT PC_PCAP_FOUND AND NOT WIN32)
+@@ -135,17 +135,7 @@ if (WIN32 AND (CMAKE_CROSSCOMPILING OR USE_MSYSTEM))
+ #VALIDATOR pcap_include_check
+ )
+ else()
+- find_path(PCAP_INCLUDE_DIR
+- NAMES
+- pcap/pcap.h
+- HINTS
+- ${PC_PCAP_INCLUDE_DIRS}
+- ${PCAP_CONFIG_INCLUDE_DIRS}
+- "${PCAP_HINTS}/Include"
+- PATHS
+- "${CMAKE_SOURCE_DIR}/libpcap"
+- #VALIDATOR pcap_include_check
+- )
++ set(PCAP_INCLUDE_DIR ${PC_PCAP_INCLUDE_DIRS})
+ endif()
+
+ # On Windows we load wpcap.dll explicitly and probe its functions in
+@@ -157,7 +147,7 @@ if(WIN32)
+ else()
+ find_library(PCAP_LIBRARY
+ NAMES
+- pcap
++ epcap
+ HINTS
+ ${PC_PCAP_LIBRARY_DIRS}
+ ${PCAP_CONFIG_LIBRARY_DIRS}
Index: net/wireshark/patches/patch-tools_radiotap-gen_CMakeLists_txt
===================================================================
RCS file: net/wireshark/patches/patch-tools_radiotap-gen_CMakeLists_txt
diff -N net/wireshark/patches/patch-tools_radiotap-gen_CMakeLists_txt
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ net/wireshark/patches/patch-tools_radiotap-gen_CMakeLists_txt 3 Mar 2026 20:41:01 -0000
@@ -0,0 +1,10 @@
+Index: tools/radiotap-gen/CMakeLists.txt
+--- tools/radiotap-gen/CMakeLists.txt.orig
++++ tools/radiotap-gen/CMakeLists.txt
+@@ -4,5 +4,6 @@ if(UNIX)
+ add_executable( radiotap-gen radiotap-gen.c )
+
+ target_link_libraries( radiotap-gen pcap ${GLIB2_LIBRARIES} )
++ target_include_directories( radiotap-gen SYSTEM PRIVATE ${PCAP_INCLUDE_DIRS} )
+
+ endif()
Index: net/wireshark/patches/patch-tools_radiotap-gen_radiotap-gen_c
===================================================================
RCS file: net/wireshark/patches/patch-tools_radiotap-gen_radiotap-gen_c
diff -N net/wireshark/patches/patch-tools_radiotap-gen_radiotap-gen_c
--- net/wireshark/patches/patch-tools_radiotap-gen_radiotap-gen_c 5 Oct 2022 13:58:00 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,12 +0,0 @@
-Index: tools/radiotap-gen/radiotap-gen.c
---- tools/radiotap-gen/radiotap-gen.c.orig
-+++ tools/radiotap-gen/radiotap-gen.c
-@@ -66,7 +66,7 @@ static void gen_u_sig_pkts(pcap_dumper_t *dumper)
- {
- struct pcap_pkthdr hdr;
- struct complete_pkt pkt;
-- struct timeval ts;
-+ struct bpf_timeval ts;
- /*
- * Create the complete packet.
- *
Index: net/wireshark/pkg/PLIST-text
===================================================================
RCS file: /cvs/ports/net/wireshark/pkg/PLIST-text,v
diff -u -p -r1.21 PLIST-text
--- net/wireshark/pkg/PLIST-text 29 Aug 2024 08:12:27 -0000 1.21
+++ net/wireshark/pkg/PLIST-text 3 Mar 2026 20:41:01 -0000
@@ -7,7 +7,6 @@
@mode
@group
@bin bin/editcap
-@bin bin/idl2wrs
@bin bin/mergecap
@bin bin/mmdbresolve
@bin bin/randpkt
@@ -20,13 +19,6 @@
@lib lib/libwiretap.so.${LIBwiretap_VERSION}
@lib lib/libwsutil.so.${LIBwsutil_VERSION}
lib/wireshark/
-lib/wireshark/extcap/
-@bin lib/wireshark/extcap/androiddump
-@bin lib/wireshark/extcap/ciscodump
-@bin lib/wireshark/extcap/randpktdump
-@bin lib/wireshark/extcap/sshdump
-@bin lib/wireshark/extcap/udpdump
-@bin lib/wireshark/extcap/wifidump
lib/wireshark/plugins/
lib/wireshark/plugins/${WVER}/
lib/wireshark/plugins/${WVER}/codecs/
@@ -53,6 +45,14 @@ lib/wireshark/plugins/${WVER}/epan/
@so lib/wireshark/plugins/${WVER}/epan/wimaxmacphy.so
lib/wireshark/plugins/${WVER}/wiretap/
@so lib/wireshark/plugins/${WVER}/wiretap/usbdump.so
+libexec/wireshark/
+libexec/wireshark/extcap/
+@bin libexec/wireshark/extcap/androiddump
+@bin libexec/wireshark/extcap/ciscodump
+@bin libexec/wireshark/extcap/randpktdump
+@bin libexec/wireshark/extcap/sshdump
+@bin libexec/wireshark/extcap/udpdump
+@bin libexec/wireshark/extcap/wifidump
@man man/man1/androiddump.1
@man man/man1/capinfos.1
@man man/man1/captype.1
@@ -67,7 +67,10 @@ lib/wireshark/plugins/${WVER}/wiretap/
@man man/man1/randpktdump.1
@man man/man1/rawshark.1
@man man/man1/reordercap.1
+@man man/man1/sshdig.1
@man man/man1/sshdump.1
+@man man/man1/strato.1
+@man man/man1/stratoshark.1
@man man/man1/text2pcap.1
@man man/man1/tshark.1
@man man/man1/udpdump.1
@@ -77,6 +80,8 @@ lib/wireshark/plugins/${WVER}/wiretap/
share/doc/wireshark/
share/doc/wireshark/COPYING
share/doc/wireshark/README.xml-output
+share/doc/wireshark/Stratoshark Release Notes.html
+share/doc/wireshark/Wireshark Release Notes.html
share/doc/wireshark/androiddump.html
share/doc/wireshark/capinfos.html
share/doc/wireshark/captype.html
@@ -92,9 +97,11 @@ share/doc/wireshark/pdml2html.xsl
share/doc/wireshark/randpkt.html
share/doc/wireshark/randpktdump.html
share/doc/wireshark/rawshark.html
-share/doc/wireshark/release-notes.html
share/doc/wireshark/reordercap.html
+share/doc/wireshark/sshdig.html
share/doc/wireshark/sshdump.html
+share/doc/wireshark/strato.html
+share/doc/wireshark/stratoshark.html
share/doc/wireshark/text2pcap.html
share/doc/wireshark/tshark.html
share/doc/wireshark/udpdump.html
@@ -110,7 +117,6 @@ share/wireshark/diameter/
share/wireshark/diameter/AlcatelLucent.xml
share/wireshark/diameter/Cisco.xml
share/wireshark/diameter/CiscoSystems.xml
-share/wireshark/diameter/Custom.xml
share/wireshark/diameter/Ericsson.xml
share/wireshark/diameter/HP.xml
share/wireshark/diameter/Huawei.xml
@@ -131,6 +137,7 @@ share/wireshark/diameter/VerizonWireless
share/wireshark/diameter/Vodafone.xml
share/wireshark/diameter/chargecontrol.xml
share/wireshark/diameter/dictionary.dtd
+share/wireshark/diameter/dictionary.ent
share/wireshark/diameter/dictionary.xml
share/wireshark/diameter/eap.xml
share/wireshark/diameter/etsie2e4.xml
@@ -195,6 +202,7 @@ share/wireshark/radius/dictionary.arista
share/wireshark/radius/dictionary.aruba
share/wireshark/radius/dictionary.ascend
share/wireshark/radius/dictionary.ascend.illegal
+share/wireshark/radius/dictionary.ascend.illegal.extended
share/wireshark/radius/dictionary.asn
share/wireshark/radius/dictionary.audiocodes
share/wireshark/radius/dictionary.avaya
@@ -272,6 +280,7 @@ share/wireshark/radius/dictionary.iea
share/wireshark/radius/dictionary.infinera
share/wireshark/radius/dictionary.infoblox
share/wireshark/radius/dictionary.infonet
+share/wireshark/radius/dictionary.ingate
share/wireshark/radius/dictionary.ipunplugged
share/wireshark/radius/dictionary.issanni
share/wireshark/radius/dictionary.itk
Index: net/nmap/Makefile
===================================================================
RCS file: /cvs/ports/net/nmap/Makefile,v
diff -u -p -r1.154 Makefile
--- net/nmap/Makefile 18 Feb 2025 21:30:55 -0000 1.154
+++ net/nmap/Makefile 3 Mar 2026 20:41:01 -0000
@@ -1,67 +1,73 @@
-COMMENT-main= scan ports and fingerprint stack of network hosts
+COMMENT= scan ports and fingerprint stack of network hosts

-MODPY_DISTV= 7.92
-DISTNAME= nmap-${MODPY_DISTV}
-PKGNAME-main= ${DISTNAME}
-REVISION-main= 1
+DISTNAME= nmap-7.98
+
+# "grep version ndiff/pyproject.toml" (used in ndiff-x.yz.dist-info files)
+MODPY_DISTV= 7.96

CATEGORIES= net security
-SITES= ${HOMEPAGE}/dist/
EXTRACT_SUFX= .tgz

HOMEPAGE= https://www.nmap.org/
+SITES= https://www.nmap.org/dist/

MAINTAINER= JR Aquino <tanawts@gmail.com>

# NPSL, https://nmap.org/npsl/npsl-annotated.html
-# For <=7.92, https://nmap.org/misc/nmap-v7.80-license.txt may be used instead
-# XXX license needs checking over before updating beyond 7.92
PERMIT_PACKAGE= Yes

-MULTI_PACKAGES= -main
+WANTLIB= ${COMPILER_LIBCXX} ${MODLUA_WANTLIB} \
+ c crypto epcap m ssl ssh2 pcre2-8 z
+
+DEBUG_PACKAGES= ${BUILD_PACKAGES}

-COMPILER= base-clang ports-gcc base-gcc
+COMPILER= base-clang ports-gcc

USE_GMAKE= Yes
MODLUA_SA= Yes
-MODLUA_VERSION= 5.3
+MODLUA_VERSION= 5.4
MODULES= lang/python \
lang/lua

-DEBUG_PACKAGES= ${BUILD_PACKAGES}
-CONFIGURE_STYLE=autoconf
-AUTOCONF_VERSION=2.69
+CONFIGURE_STYLE= autoconf
+AUTOCONF_VERSION= 2.71
+AUTOCONF_DIR= ${WRKSRC} ${WRKSRC}/ncat ${WRKSRC}/nping ${WRKSRC}/nsock/src

-CONFIGURE_ENV= CFLAGS="${CFLAGS} -I${LOCALBASE}/include" \
- CPPFLAGS="${CPPFLAGS} -I${LOCALBASE}/include -I${MODLUA_INCL_DIR}" \
+CONFIGURE_ENV= CFLAGS="${CFLAGS}" \
+ CPPFLAGS="-I${LOCALBASE}/include/libpcap -I${LOCALBASE}/include -I${MODLUA_INCL_DIR}" \
CXXFLAGS="${CXXFLAGS} -I${LOCALBASE}/include" \
- LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib ${MODLUA_LIB}" \
+ LDFLAGS="${LDFLAGS} -L${LOCALBASE}/lib" \
YACC="${LOCALBASE}/bin/bison -y"
-# XXX uses internal copy of libpcap, previous attempts to deal with the
-# bpf_timeval changes in base libpcap have not been entirely successful
-CONFIGURE_ARGS= --with-libpcap=included \
- --with-openssl=/usr \
+CONFIGURE_ARGS= --with-openssl=/usr \
--with-liblua=${LOCALBASE} \
--with-libpcre=${LOCALBASE} \
--with-mandir=${LOCALBASE}/man \
+ --without-ndiff \
--without-nmap-update \
--without-zenmap \
--disable-nls

-WANTLIB-main= ${COMPILER_LIBCXX} ${MODLUA_WANTLIB} \
- c crypto m ssl ssh2 pcre z
-LIB_DEPENDS-main= ${MODLUA_LIB_DEPENDS} \
- devel/pcre \
+BUILD_DEPENDS= devel/bison
+LIB_DEPENDS= ${MODLUA_LIB_DEPENDS} \
+ devel/pcre2 \
+ net/libpcap \
security/libssh2

-BUILD_DEPENDS= devel/bison \
- devel/py-setuptools
-
post-extract:
- @cd ${WRKSRC} && rm -rf liblua/ libpcre/
+ cd ${WRKSRC}; rm -rf liblua libssh2 libpcap libpcre libz
+
+MODPY_PYBUILD= setuptools
+MODPY_BUILD_DIR= ${WRKSRC}/ndiff

-pre-configure:
- @cd ${WRKSRC}/nping ; env PATH=${PORTPATH} \
- AUTOCONF_VERSION=${AUTOCONF_VERSION} autoconf
+post-build:
+ ${MODPY_BUILD_TARGET}
+
+post-install:
+ ${MODPY_INSTALL_TARGET}
+ ${INSTALL_MAN} ${WRKSRC}/ndiff/docs/ndiff.1 ${PREFIX}/man/man1/

.include <bsd.port.mk>
+
+.if defined(DEBUG)
+FAKE_FLAGS= STRIP=:
+.endif
Index: net/nmap/distinfo
===================================================================
RCS file: /cvs/ports/net/nmap/distinfo,v
diff -u -p -r1.42 distinfo
--- net/nmap/distinfo 7 May 2024 15:19:43 -0000 1.42
+++ net/nmap/distinfo 3 Mar 2026 20:41:01 -0000
@@ -1,2 +1,2 @@
-SHA256 (nmap-7.92.tgz) = BkGD6mQtxMErGrO1NYzhzvfS5+Ef+ihJ8W0zn1txcRc=
-SIZE (nmap-7.92.tgz) = 12985468
+SHA256 (nmap-7.98.tgz) = jC8l0RwqKirnZEHL45b/p/CtcY21oUXZlnJp8cqDE3A=
+SIZE (nmap-7.98.tgz) = 14987565
Index: net/nmap/patches/patch-configure_ac
===================================================================
RCS file: /cvs/ports/net/nmap/patches/patch-configure_ac,v
diff -u -p -r1.2 patch-configure_ac
--- net/nmap/patches/patch-configure_ac 4 Dec 2022 18:18:24 -0000 1.2
+++ net/nmap/patches/patch-configure_ac 3 Mar 2026 20:41:01 -0000
@@ -1,12 +1,42 @@
Index: configure.ac
--- configure.ac.orig
+++ configure.ac
-@@ -241,7 +241,7 @@ NDIFFDIR=ndiff
+@@ -439,7 +439,7 @@ AC_HELP_STRING([--with-libpcap=included], [Always use
+ [ case "$with_libpcap" in
+ yes)
+ AC_CHECK_HEADER(pcap.h,[
+- AC_CHECK_LIB(pcap, pcap_create,
++ AC_CHECK_LIB(epcap, pcap_create,
+ [have_libpcap=yes ])])
+ ;;
+ included)
+@@ -453,9 +453,9 @@ AC_HELP_STRING([--with-libpcap=included], [Always use
+ LDFLAGS="-L$with_libpcap/lib $LDFLAGS"

- # Do they want Ndiff?
- AC_ARG_WITH(ndiff, AC_HELP_STRING([--without-ndiff], [Skip installation of the Ndiff utility]), [], [with_ndiff=check])
--if $HAVE_PYTHON2 ; then : ;
-+if $HAVE_PYTHON ; then : ;
- else
- if test "$with_ndiff" = "check" ; then
- AC_MSG_WARN([Not building Ndiff because Python 2.x with x>=4 was not found])
+ AC_CHECK_HEADER(pcap.h,[
+- AC_CHECK_LIB(pcap, pcap_create,
++ AC_CHECK_LIB(epcap, pcap_create,
+ [have_libpcap=yes
+- LIBPCAP_INC=$with_libpcap/include
++ LIBPCAP_INC=$with_libpcap/include/libpcap
+ LIBPCAP_LIB=$with_libpcap/lib])])
+
+ LDFLAGS=$_ldflags
+@@ -476,7 +476,7 @@ if test $have_libpcap = yes; then
+
+ # link with -lpcap for the purposes of this test
+ LIBS_OLD="$LIBS"
+- LIBS="$LIBS -lpcap"
++ LIBS="$LIBS -lepcap"
+ PCAP_IS_SUITABLE([have_libpcap=yes], [have_libpcap=no], [have_libpcap=yes])
+ LIBS="$LIBS_OLD"
+ fi
+@@ -504,7 +504,7 @@ else
+ LIBS="$LIBS_OLD"
+
+ AC_DEFINE(HAVE_LIBPCAP, 1, [Have libpcap library])
+- LIBPCAP_LIBS="-lpcap"
++ LIBPCAP_LIBS="-lepcap"
+ PCAP_BUILD=""
+ PCAP_CLEAN=""
+ PCAP_DIST_CLEAN=""
Index: net/nmap/patches/patch-ncat_configure_ac
===================================================================
RCS file: net/nmap/patches/patch-ncat_configure_ac
diff -N net/nmap/patches/patch-ncat_configure_ac
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ net/nmap/patches/patch-ncat_configure_ac 3 Mar 2026 20:41:01 -0000
@@ -0,0 +1,39 @@
+Index: ncat/configure.ac
+--- ncat/configure.ac.orig
++++ ncat/configure.ac
+@@ -130,7 +130,7 @@ AC_HELP_STRING([--with-libpcap=included], [Always use
+ [ case "$with_libpcap" in
+ yes)
+ AC_CHECK_HEADER(pcap.h,[
+- AC_CHECK_LIB(pcap, pcap_create,
++ AC_CHECK_LIB(epcap, pcap_create,
+ [have_libpcap=yes ])])
+ ;;
+ included)
+@@ -144,9 +144,9 @@ AC_HELP_STRING([--with-libpcap=included], [Always use
+ LDFLAGS="-L$with_libpcap/lib $LDFLAGS"
+
+ AC_CHECK_HEADER(pcap.h,[
+- AC_CHECK_LIB(pcap, pcap_create,
++ AC_CHECK_LIB(epcap, pcap_create,
+ [have_libpcap=yes
+- LIBPCAP_INC=$with_libpcap/include
++ LIBPCAP_INC=$with_libpcap/include/libpcap
+ LIBPCAP_LIB=$with_libpcap/lib])])
+
+ LDFLAGS=$_ldflags
+@@ -166,12 +166,12 @@ if test $have_libpcap = yes; then
+
+ # link with -lpcap for the purposes of this test
+ LIBS_OLD="$LIBS"
+- LIBS="$LIBS -lpcap"
++ LIBS="$LIBS -lepcap"
+ PCAP_IS_SUITABLE([have_libpcap=yes], [have_libpcap=no], [have_libpcap=yes])
+ LIBS="$LIBS_OLD"
+ fi
+
+-PCAP_LIBS="-lpcap"
++PCAP_LIBS="-lepcap"
+ if test $have_libpcap = yes; then
+ PCAP_DEPENDS=""
+ PCAP_BUILD=""
Index: net/nmap/patches/patch-ndiff_ndiff_py
===================================================================
RCS file: net/nmap/patches/patch-ndiff_ndiff_py
diff -N net/nmap/patches/patch-ndiff_ndiff_py
--- net/nmap/patches/patch-ndiff_ndiff_py 18 Feb 2025 21:30:55 -0000 1.2
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,1183 +0,0 @@
-apply 2to3 and additional fixes
-
-Index: ndiff/ndiff.py
---- ndiff/ndiff.py.orig
-+++ ndiff/ndiff.py
-@@ -26,12 +26,14 @@ xml.__path__ = [x for x in xml.__path__ if "_xmlplus"
- import xml.sax
- import xml.sax.saxutils
- import xml.dom.minidom
--from StringIO import StringIO
-+from io import StringIO
-
- verbose = False
-
--NDIFF_XML_VERSION = u"1"
-+NDIFF_XML_VERSION = "1"
-
-+def cmp(x, y):
-+ return (x > y) - (x < y)
-
- class OverrideEntityResolver(xml.sax.handler.EntityResolver):
- """This class overrides the default behavior of xml.sax to download
-@@ -75,35 +77,35 @@ class Scan(object):
- def write_nmaprun_open(self, writer):
- attrs = {}
- if self.scanner is not None:
-- attrs[u"scanner"] = self.scanner
-+ attrs["scanner"] = self.scanner
- if self.args is not None:
-- attrs[u"args"] = self.args
-+ attrs["args"] = self.args
- if self.start_date is not None:
-- attrs[u"start"] = "%d" % time.mktime(self.start_date.timetuple())
-- attrs[u"startstr"] = self.start_date.strftime(
-+ attrs["start"] = "%d" % time.mktime(self.start_date.timetuple())
-+ attrs["startstr"] = self.start_date.strftime(
- "%a %b %d %H:%M:%S %Y")
- if self.version is not None:
-- attrs[u"version"] = self.version
-- writer.startElement(u"nmaprun", attrs)
-+ attrs["version"] = self.version
-+ writer.startElement("nmaprun", attrs)
-
- def write_nmaprun_close(self, writer):
-- writer.endElement(u"nmaprun")
-+ writer.endElement("nmaprun")
-
- def nmaprun_to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"nmaprun")
-+ elem = document.createElement("nmaprun")
- if self.scanner is not None:
-- elem.setAttribute(u"scanner", self.scanner)
-+ elem.setAttribute("scanner", self.scanner)
- if self.args is not None:
-- elem.setAttribute(u"args", self.args)
-+ elem.setAttribute("args", self.args)
- if self.start_date is not None:
- elem.setAttribute(
-- u"start", "%d" % time.mktime(self.start_date.timetuple()))
-+ "start", "%d" % time.mktime(self.start_date.timetuple()))
- elem.setAttribute(
-- u"startstr",
-+ "startstr",
- self.start_date.strftime("%a %b %d %H:%M:%S %Y"))
- if self.version is not None:
-- elem.setAttribute(u"version", self.version)
-+ elem.setAttribute("version", self.version)
- frag.appendChild(elem)
- return frag
-
-@@ -133,17 +135,17 @@ class Host(object):
-
- def format_name(self):
- """Return a human-readable identifier for this host."""
-- address_s = u", ".join(a.s for a in sorted(self.addresses))
-- hostname_s = u", ".join(sorted(self.hostnames))
-+ address_s = ", ".join(a.s for a in sorted(self.addresses))
-+ hostname_s = ", ".join(sorted(self.hostnames))
- if len(hostname_s) > 0:
- if len(address_s) > 0:
-- return u"%s (%s)" % (hostname_s, address_s)
-+ return "%s (%s)" % (hostname_s, address_s)
- else:
- return hostname_s
- elif len(address_s) > 0:
- return address_s
- else:
-- return u"<no name>"
-+ return "<no name>"
-
- def add_port(self, port):
- self.ports[port.spec] = port
-@@ -160,46 +162,46 @@ class Host(object):
- return state is None or state in self.extraports
-
- def extraports_string(self):
-- list = [(count, state) for (state, count) in self.extraports.items()]
-+ mylist = [(count, state) for (state, count) in list(self.extraports.items())]
- # Reverse-sort by count.
-- list.sort(reverse=True)
-- return u", ".join(
-- [u"%d %s ports" % (count, state) for (count, state) in list])
-+ mylist.sort(reverse=True)
-+ return ", ".join(
-+ ["%d %s ports" % (count, state) for (count, state) in mylist])
-
- def state_to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
- if self.state is not None:
-- elem = document.createElement(u"status")
-- elem.setAttribute(u"state", self.state)
-+ elem = document.createElement("status")
-+ elem.setAttribute("state", self.state)
- frag.appendChild(elem)
- return frag
-
- def hostname_to_dom_fragment(self, document, hostname):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"hostname")
-- elem.setAttribute(u"name", hostname)
-+ elem = document.createElement("hostname")
-+ elem.setAttribute("name", hostname)
- frag.appendChild(elem)
- return frag
-
- def extraports_to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- for state, count in self.extraports.items():
-- elem = document.createElement(u"extraports")
-- elem.setAttribute(u"state", state)
-- elem.setAttribute(u"count", unicode(count))
-+ for state, count in mylist(self.extraports.items()):
-+ elem = document.createElement("extraports")
-+ elem.setAttribute("state", state)
-+ elem.setAttribute("count", str(count))
- frag.appendChild(elem)
- return frag
-
- def os_to_dom_fragment(self, document, os):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"osmatch")
-- elem.setAttribute(u"name", os)
-+ elem = document.createElement("osmatch")
-+ elem.setAttribute("name", os)
- frag.appendChild(elem)
- return frag
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"host")
-+ elem = document.createElement("host")
-
- if self.state is not None:
- elem.appendChild(self.state_to_dom_fragment(document))
-@@ -208,13 +210,13 @@ class Host(object):
- elem.appendChild(addr.to_dom_fragment(document))
-
- if len(self.hostnames) > 0:
-- hostnames_elem = document.createElement(u"hostnames")
-+ hostnames_elem = document.createElement("hostnames")
- for hostname in self.hostnames:
- hostnames_elem.appendChild(
- self.hostname_to_dom_fragment(document, hostname))
- elem.appendChild(hostnames_elem)
-
-- ports_elem = document.createElement(u"ports")
-+ ports_elem = document.createElement("ports")
- ports_elem.appendChild(self.extraports_to_dom_fragment(document))
- for port in sorted(self.ports.values()):
- if not self.is_extraports(port.state):
-@@ -223,13 +225,13 @@ class Host(object):
- elem.appendChild(ports_elem)
-
- if len(self.os) > 0:
-- os_elem = document.createElement(u"os")
-+ os_elem = document.createElement("os")
- for os in self.os:
- os_elem.appendChild(self.os_to_dom_fragment(document, os))
- elem.appendChild(os_elem)
-
- if len(self.script_results) > 0:
-- hostscript_elem = document.createElement(u"hostscript")
-+ hostscript_elem = document.createElement("hostscript")
- for sr in self.script_results:
- hostscript_elem.appendChild(sr.to_dom_fragment(document))
- elem.appendChild(hostscript_elem)
-@@ -261,21 +263,21 @@ class Address(object):
- return self.s
-
- def new(type, s):
-- if type == u"ipv4":
-+ if type == "ipv4":
- return IPv4Address(s)
-- elif type == u"ipv6":
-+ elif type == "ipv6":
- return IPv6Address(s)
-- elif type == u"mac":
-+ elif type == "mac":
- return MACAddress(s)
- else:
-- raise ValueError(u"Unknown address type %s." % type)
-+ raise ValueError("Unknown address type %s." % type)
- new = staticmethod(new)
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"address")
-- elem.setAttribute(u"addr", self.s)
-- elem.setAttribute(u"addrtype", self.type)
-+ elem = document.createElement("address")
-+ elem.setAttribute("addr", self.s)
-+ elem.setAttribute("addrtype", self.type)
- frag.appendChild(elem)
- return frag
-
-@@ -284,21 +286,21 @@ class Address(object):
-
-
- class IPv4Address(Address):
-- type = property(lambda self: u"ipv4")
-+ type = property(lambda self: "ipv4")
-
- def sort_key(self):
- return (0, self.s)
-
-
- class IPv6Address(Address):
-- type = property(lambda self: u"ipv6")
-+ type = property(lambda self: "ipv6")
-
- def sort_key(self):
- return (1, self.s)
-
-
- class MACAddress(Address):
-- type = property(lambda self: u"mac")
-+ type = property(lambda self: "mac")
-
- def sort_key(self):
- return (2, self.s)
-@@ -317,12 +319,12 @@ class Port(object):
-
- def state_string(self):
- if self.state is None:
-- return u"unknown"
-+ return "unknown"
- else:
-- return unicode(self.state)
-+ return str(self.state)
-
- def spec_string(self):
-- return u"%d/%s" % self.spec
-+ return "%d/%s" % self.spec
-
- def __hash__(self):
- return hash(self.spec)
-@@ -336,12 +338,12 @@ class Port(object):
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"port")
-- elem.setAttribute(u"portid", unicode(self.spec[0]))
-- elem.setAttribute(u"protocol", self.spec[1])
-+ elem = document.createElement("port")
-+ elem.setAttribute("portid", str(self.spec[0]))
-+ elem.setAttribute("protocol", self.spec[1])
- if self.state is not None:
-- state_elem = document.createElement(u"state")
-- state_elem.setAttribute(u"state", self.state)
-+ state_elem = document.createElement("state")
-+ state_elem.setAttribute("state", self.state)
- elem.appendChild(state_elem)
- elem.appendChild(self.service.to_dom_fragment(document))
- for sr in self.script_results:
-@@ -385,7 +387,7 @@ class Service(object):
- if len(parts) == 0:
- return None
- else:
-- return u"/".join(parts)
-+ return "/".join(parts)
-
- def version_string(self):
- """Get a string like in the VERSION column of Nmap output."""
-@@ -395,17 +397,17 @@ class Service(object):
- if self.version is not None:
- parts.append(self.version)
- if self.extrainfo is not None:
-- parts.append(u"(%s)" % self.extrainfo)
-+ parts.append("(%s)" % self.extrainfo)
-
- if len(parts) == 0:
- return None
- else:
-- return u" ".join(parts)
-+ return " ".join(parts)
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"service")
-- for attr in (u"name", u"product", u"version", u"extrainfo", u"tunnel"):
-+ elem = document.createElement("service")
-+ for attr in ("name", "product", "version", "extrainfo", "tunnel"):
- v = getattr(self, attr)
- if v is None:
- continue
-@@ -435,53 +437,53 @@ class ScriptResult(object):
- result = []
- lines = self.output.splitlines()
- if len(lines) > 0:
-- lines[0] = self.id + u": " + lines[0]
-+ lines[0] = self.id + ": " + lines[0]
- for line in lines[:-1]:
-- result.append(u"| " + line)
-+ result.append("| " + line)
- if len(lines) > 0:
-- result.append(u"|_ " + lines[-1])
-+ result.append("|_ " + lines[-1])
- return result
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- elem = document.createElement(u"script")
-- elem.setAttribute(u"id", self.id)
-- elem.setAttribute(u"output", self.output)
-+ elem = document.createElement("script")
-+ elem.setAttribute("id", self.id)
-+ elem.setAttribute("output", self.output)
- frag.appendChild(elem)
- return frag
-
-
- def format_banner(scan):
- """Format a startup banner more or less like Nmap does."""
-- scanner = u"Nmap"
-- if scan.scanner is not None and scan.scanner != u"nmap":
-+ scanner = "Nmap"
-+ if scan.scanner is not None and scan.scanner != "nmap":
- scanner = scan.scanner
- parts = [scanner]
- if scan.version is not None:
- parts.append(scan.version)
-- parts.append(u"scan")
-+ parts.append("scan")
- if scan.start_date is not None:
-- parts.append(u"initiated %s" % scan.start_date.strftime(
-+ parts.append("initiated %s" % scan.start_date.strftime(
- "%a %b %d %H:%M:%S %Y"))
- if scan.args is not None:
-- parts.append(u"as: %s" % scan.args)
-- return u" ".join(parts)
-+ parts.append("as: %s" % scan.args)
-+ return " ".join(parts)
-
-
- def print_script_result_diffs_text(title, script_results_a, script_results_b,
- script_result_diffs, f=sys.stdout):
-- table = Table(u"*")
-+ table = Table("*")
- for sr_diff in script_result_diffs:
- sr_diff.append_to_port_table(table)
- if len(table) > 0:
-- print >> f
-+ print(file=f)
- if len(script_results_b) == 0:
-- print >> f, u"-%s:" % title
-+ print("-%s:" % title, file=f)
- elif len(script_results_a) == 0:
-- print >> f, u"+%s:" % title
-+ print("+%s:" % title, file=f)
- else:
-- print >> f, u" %s:" % title
-- print >> f, table
-+ print(" %s:" % title, file=f)
-+ print(table, file=f)
-
-
- def script_result_diffs_to_dom_fragment(elem, script_results_a,
-@@ -489,13 +491,13 @@ def script_result_diffs_to_dom_fragment(elem, script_r
- if len(script_results_a) == 0 and len(script_results_b) == 0:
- return document.createDocumentFragment()
- elif len(script_results_b) == 0:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- for sr in script_results_a:
- elem.appendChild(sr.to_dom_fragment(document))
- a_elem.appendChild(elem)
- return a_elem
- elif len(script_results_a) == 0:
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- for sr in script_results_b:
- elem.appendChild(sr.to_dom_fragment(document))
- b_elem.appendChild(elem)
-@@ -580,10 +582,10 @@ class ScanDiffText(ScanDiff):
- banner_a = format_banner(self.scan_a)
- banner_b = format_banner(self.scan_b)
- if banner_a != banner_b:
-- print >> self.f, u"-%s" % banner_a
-- print >> self.f, u"+%s" % banner_b
-+ print("-%s" % banner_a, file=self.f)
-+ print("+%s" % banner_b, file=self.f)
- elif verbose:
-- print >> self.f, u" %s" % banner_a
-+ print(" %s" % banner_a, file=self.f)
-
- def output_pre_scripts(self, pre_script_result_diffs):
- print_script_result_diffs_text("Pre-scan script results",
-@@ -596,7 +598,7 @@ class ScanDiffText(ScanDiff):
- post_script_result_diffs, self.f)
-
- def output_host_diff(self, h_diff):
-- print >> self.f
-+ print(file=self.f)
- h_diff.print_text(self.f)
-
- def output_ending(self):
-@@ -621,8 +623,8 @@ class ScanDiffXML(ScanDiff):
-
- def output_beginning(self):
- self.writer.startDocument()
-- self.writer.startElement(u"nmapdiff", {u"version": NDIFF_XML_VERSION})
-- self.writer.startElement(u"scandiff", {})
-+ self.writer.startElement("nmapdiff", {"version": NDIFF_XML_VERSION})
-+ self.writer.startElement("scandiff", {})
-
- if self.nmaprun_differs():
- self.writer.frag_a(
-@@ -635,7 +637,7 @@ class ScanDiffXML(ScanDiff):
-
- def output_pre_scripts(self, pre_script_result_diffs):
- if len(pre_script_result_diffs) > 0 or verbose:
-- prescript_elem = self.document.createElement(u"prescript")
-+ prescript_elem = self.document.createElement("prescript")
- frag = script_result_diffs_to_dom_fragment(
- prescript_elem, self.scan_a.pre_script_results,
- self.scan_b.pre_script_results, pre_script_result_diffs,
-@@ -645,7 +647,7 @@ class ScanDiffXML(ScanDiff):
-
- def output_post_scripts(self, post_script_result_diffs):
- if len(post_script_result_diffs) > 0 or verbose:
-- postscript_elem = self.document.createElement(u"postscript")
-+ postscript_elem = self.document.createElement("postscript")
- frag = script_result_diffs_to_dom_fragment(
- postscript_elem, self.scan_a.post_script_results,
- self.scan_b.post_script_results, post_script_result_diffs,
-@@ -659,8 +661,8 @@ class ScanDiffXML(ScanDiff):
- frag.unlink()
-
- def output_ending(self):
-- self.writer.endElement(u"scandiff")
-- self.writer.endElement(u"nmapdiff")
-+ self.writer.endElement("scandiff")
-+ self.writer.endElement("nmapdiff")
- self.writer.endDocument()
-
-
-@@ -718,9 +720,9 @@ class HostDiff(object):
- self.cost += os_cost
-
- extraports_a = tuple((count, state)
-- for (state, count) in self.host_a.extraports.items())
-+ for (state, count) in list(self.host_a.extraports.items()))
- extraports_b = tuple((count, state)
-- for (state, count) in self.host_b.extraports.items())
-+ for (state, count) in list(self.host_b.extraports.items()))
- if extraports_a != extraports_b:
- self.extraports_changed = True
- self.cost += 1
-@@ -746,69 +748,69 @@ class HostDiff(object):
- # Names and addresses.
- if self.id_changed:
- if host_a.state is not None:
-- print >> f, u"-%s:" % host_a.format_name()
-+ print("-%s:" % host_a.format_name(), file=f)
- if self.host_b.state is not None:
-- print >> f, u"+%s:" % host_b.format_name()
-+ print("+%s:" % host_b.format_name(), file=f)
- else:
-- print >> f, u" %s:" % host_a.format_name()
-+ print(" %s:" % host_a.format_name(), file=f)
-
- # State.
- if self.state_changed:
- if host_a.state is not None:
-- print >> f, u"-Host is %s." % host_a.state
-+ print("-Host is %s." % host_a.state, file=f)
- if host_b.state is not None:
-- print >> f, u"+Host is %s." % host_b.state
-+ print("+Host is %s." % host_b.state, file=f)
- elif verbose:
-- print >> f, u" Host is %s." % host_b.state
-+ print(" Host is %s." % host_b.state, file=f)
-
- # Extraports.
- if self.extraports_changed:
- if len(host_a.extraports) > 0:
-- print >> f, u"-Not shown: %s" % host_a.extraports_string()
-+ print("-Not shown: %s" % host_a.extraports_string(), file=f)
- if len(host_b.extraports) > 0:
-- print >> f, u"+Not shown: %s" % host_b.extraports_string()
-+ print("+Not shown: %s" % host_b.extraports_string(), file=f)
- elif verbose:
- if len(host_a.extraports) > 0:
-- print >> f, u" Not shown: %s" % host_a.extraports_string()
-+ print(" Not shown: %s" % host_a.extraports_string(), file=f)
-
- # Port table.
-- port_table = Table(u"** * * *")
-+ port_table = Table("** * * *")
- if host_a.state is None:
-- mark = u"+"
-+ mark = "+"
- elif host_b.state is None:
-- mark = u"-"
-+ mark = "-"
- else:
-- mark = u" "
-- port_table.append((mark, u"PORT", u"STATE", u"SERVICE", u"VERSION"))
-+ mark = " "
-+ port_table.append((mark, "PORT", "STATE", "SERVICE", "VERSION"))
-
- for port in self.ports:
- port_diff = self.port_diffs[port]
- port_diff.append_to_port_table(port_table, host_a, host_b)
-
- if len(port_table) > 1:
-- print >> f, port_table
-+ print(port_table, file=f)
-
- # OS changes.
- if self.os_changed or verbose:
- if len(host_a.os) > 0:
- if len(host_b.os) > 0:
-- print >> f, u" OS details:"
-+ print(" OS details:", file=f)
- else:
-- print >> f, u"-OS details:"
-+ print("-OS details:", file=f)
- elif len(host_b.os) > 0:
-- print >> f, u"+OS details:"
-+ print("+OS details:", file=f)
- # os_diffs is a list of 5-tuples returned by
- # difflib.SequenceMatcher.
- for op, i1, i2, j1, j2 in self.os_diffs:
- if op == "replace" or op == "delete":
- for i in range(i1, i2):
-- print >> f, "- %s" % host_a.os[i]
-+ print("- %s" % host_a.os[i], file=f)
- if op == "replace" or op == "insert":
- for i in range(j1, j2):
-- print >> f, "+ %s" % host_b.os[i]
-+ print("+ %s" % host_b.os[i], file=f)
- if op == "equal":
- for i in range(i1, i2):
-- print >> f, " %s" % host_a.os[i]
-+ print(" %s" % host_a.os[i], file=f)
-
- print_script_result_diffs_text("Host script results",
- host_a.script_results, host_b.script_results,
-@@ -819,32 +821,32 @@ class HostDiff(object):
- host_b = self.host_b
-
- frag = document.createDocumentFragment()
-- hostdiff_elem = document.createElement(u"hostdiff")
-+ hostdiff_elem = document.createElement("hostdiff")
- frag.appendChild(hostdiff_elem)
-
- if host_a.state is None or host_b.state is None:
- # The host is missing in one scan. Output the whole thing.
- if host_a.state is not None:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- a_elem.appendChild(host_a.to_dom_fragment(document))
- hostdiff_elem.appendChild(a_elem)
- elif host_b.state is not None:
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- b_elem.appendChild(host_b.to_dom_fragment(document))
- hostdiff_elem.appendChild(b_elem)
- return frag
-
-- host_elem = document.createElement(u"host")
-+ host_elem = document.createElement("host")
-
- # State.
- if host_a.state == host_b.state:
- if verbose:
- host_elem.appendChild(host_a.state_to_dom_fragment(document))
- else:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- a_elem.appendChild(host_a.state_to_dom_fragment(document))
- host_elem.appendChild(a_elem)
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- b_elem.appendChild(host_b.state_to_dom_fragment(document))
- host_elem.appendChild(b_elem)
-
-@@ -853,31 +855,31 @@ class HostDiff(object):
- addrset_b = set(host_b.addresses)
- for addr in sorted(addrset_a.intersection(addrset_b)):
- host_elem.appendChild(addr.to_dom_fragment(document))
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- for addr in sorted(addrset_a - addrset_b):
- a_elem.appendChild(addr.to_dom_fragment(document))
- if a_elem.hasChildNodes():
- host_elem.appendChild(a_elem)
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- for addr in sorted(addrset_b - addrset_a):
- b_elem.appendChild(addr.to_dom_fragment(document))
- if b_elem.hasChildNodes():
- host_elem.appendChild(b_elem)
-
- # Host names.
-- hostnames_elem = document.createElement(u"hostnames")
-+ hostnames_elem = document.createElement("hostnames")
- hostnameset_a = set(host_a.hostnames)
- hostnameset_b = set(host_b.hostnames)
- for hostname in sorted(hostnameset_a.intersection(hostnameset_b)):
- hostnames_elem.appendChild(
- host_a.hostname_to_dom_fragment(document, hostname))
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- for hostname in sorted(hostnameset_a - hostnameset_b):
- a_elem.appendChild(
- host_a.hostname_to_dom_fragment(document, hostname))
- if a_elem.hasChildNodes():
- hostnames_elem.appendChild(a_elem)
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- for hostname in sorted(hostnameset_b - hostnameset_a):
- b_elem.appendChild(
- host_b.hostname_to_dom_fragment(document, hostname))
-@@ -886,15 +888,15 @@ class HostDiff(object):
- if hostnames_elem.hasChildNodes():
- host_elem.appendChild(hostnames_elem)
-
-- ports_elem = document.createElement(u"ports")
-+ ports_elem = document.createElement("ports")
- # Extraports.
- if host_a.extraports == host_b.extraports:
- ports_elem.appendChild(host_a.extraports_to_dom_fragment(document))
- else:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- a_elem.appendChild(host_a.extraports_to_dom_fragment(document))
- ports_elem.appendChild(a_elem)
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- b_elem.appendChild(host_b.extraports_to_dom_fragment(document))
- ports_elem.appendChild(b_elem)
- # Port list.
-@@ -910,18 +912,18 @@ class HostDiff(object):
-
- # OS changes.
- if self.os_changed or verbose:
-- os_elem = document.createElement(u"os")
-+ os_elem = document.createElement("os")
- # os_diffs is a list of 5-tuples returned by
- # difflib.SequenceMatcher.
- for op, i1, i2, j1, j2 in self.os_diffs:
- if op == "replace" or op == "delete":
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- for i in range(i1, i2):
- a_elem.appendChild(host_a.os_to_dom_fragment(
- document, host_a.os[i]))
- os_elem.appendChild(a_elem)
- if op == "replace" or op == "insert":
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- for i in range(j1, j2):
- b_elem.appendChild(host_b.os_to_dom_fragment(
- document, host_b.os[i]))
-@@ -935,7 +937,7 @@ class HostDiff(object):
-
- # Host script changes.
- if len(self.script_result_diffs) > 0 or verbose:
-- hostscript_elem = document.createElement(u"hostscript")
-+ hostscript_elem = document.createElement("hostscript")
- host_elem.appendChild(script_result_diffs_to_dom_fragment(
- hostscript_elem, host_a.script_results,
- host_b.script_results, self.script_result_diffs,
-@@ -988,38 +990,38 @@ class PortDiff(object):
- self.port_b.service.version_string()]
- if a_columns == b_columns:
- if verbose or self.script_result_diffs > 0:
-- table.append([u" "] + a_columns)
-+ table.append([" "] + a_columns)
- else:
- if not host_a.is_extraports(self.port_a.state):
-- table.append([u"-"] + a_columns)
-+ table.append(["-"] + a_columns)
- if not host_b.is_extraports(self.port_b.state):
-- table.append([u"+"] + b_columns)
-+ table.append(["+"] + b_columns)
-
- for sr_diff in self.script_result_diffs:
- sr_diff.append_to_port_table(table)
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-- portdiff_elem = document.createElement(u"portdiff")
-+ portdiff_elem = document.createElement("portdiff")
- frag.appendChild(portdiff_elem)
- if (self.port_a.spec == self.port_b.spec and
- self.port_a.state == self.port_b.state):
-- port_elem = document.createElement(u"port")
-- port_elem.setAttribute(u"portid", unicode(self.port_a.spec[0]))
-- port_elem.setAttribute(u"protocol", self.port_a.spec[1])
-+ port_elem = document.createElement("port")
-+ port_elem.setAttribute("portid", str(self.port_a.spec[0]))
-+ port_elem.setAttribute("protocol", self.port_a.spec[1])
- if self.port_a.state is not None:
-- state_elem = document.createElement(u"state")
-- state_elem.setAttribute(u"state", self.port_a.state)
-+ state_elem = document.createElement("state")
-+ state_elem.setAttribute("state", self.port_a.state)
- port_elem.appendChild(state_elem)
- if self.port_a.service == self.port_b.service:
- port_elem.appendChild(
- self.port_a.service.to_dom_fragment(document))
- else:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- a_elem.appendChild(
- self.port_a.service.to_dom_fragment(document))
- port_elem.appendChild(a_elem)
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- b_elem.appendChild(
- self.port_b.service.to_dom_fragment(document))
- port_elem.appendChild(b_elem)
-@@ -1027,10 +1029,10 @@ class PortDiff(object):
- port_elem.appendChild(sr_diff.to_dom_fragment(document))
- portdiff_elem.appendChild(port_elem)
- else:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- a_elem.appendChild(self.port_a.to_dom_fragment(document))
- portdiff_elem.appendChild(a_elem)
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- b_elem.appendChild(self.port_b.to_dom_fragment(document))
- portdiff_elem.appendChild(b_elem)
-
-@@ -1085,13 +1087,13 @@ class ScriptResultDiff(object):
- for op, i1, i2, j1, j2 in diffs.get_opcodes():
- if op == "replace" or op == "delete":
- for k in range(i1, i2):
-- table.append_raw(u"-" + a_lines[k])
-+ table.append_raw("-" + a_lines[k])
- if op == "replace" or op == "insert":
- for k in range(j1, j2):
-- table.append_raw(u"+" + b_lines[k])
-+ table.append_raw("+" + b_lines[k])
- if op == "equal":
- for k in range(i1, i2):
-- table.append_raw(u" " + a_lines[k])
-+ table.append_raw(" " + a_lines[k])
-
- def to_dom_fragment(self, document):
- frag = document.createDocumentFragment()
-@@ -1101,11 +1103,11 @@ class ScriptResultDiff(object):
- frag.appendChild(self.sr_a.to_dom_fragment(document))
- else:
- if self.sr_a is not None:
-- a_elem = document.createElement(u"a")
-+ a_elem = document.createElement("a")
- a_elem.appendChild(self.sr_a.to_dom_fragment(document))
- frag.appendChild(a_elem)
- if self.sr_b is not None:
-- b_elem = document.createElement(u"b")
-+ b_elem = document.createElement("b")
- b_elem.appendChild(self.sr_b.to_dom_fragment(document))
- frag.appendChild(b_elem)
- return frag
-@@ -1119,7 +1121,7 @@ class Table(object):
- copied to the output."""
- self.widths = []
- self.rows = []
-- self.prefix = u""
-+ self.prefix = ""
- self.padding = []
- j = 0
- while j < len(template) and template[j] != "*":
-@@ -1144,7 +1146,7 @@ class Table(object):
-
- for i in range(len(row)):
- if row[i] is None:
-- s = u""
-+ s = ""
- else:
- s = str(row[i])
- if i == len(self.widths):
-@@ -1166,7 +1168,7 @@ class Table(object):
- for row in self.rows:
- parts = [self.prefix]
- i = 0
-- if isinstance(row, basestring):
-+ if isinstance(row, str):
- # A raw string.
- lines.append(row)
- else:
-@@ -1175,13 +1177,13 @@ class Table(object):
- if i < len(self.padding):
- parts.append(self.padding[i])
- i += 1
-- lines.append(u"".join(parts).rstrip())
-- return u"\n".join(lines)
-+ lines.append("".join(parts).rstrip())
-+ return "\n".join(lines)
-
-
- def warn(str):
- """Print a warning to stderr."""
-- print >> sys.stderr, str
-+ print(str, file=sys.stderr)
-
-
- class NmapContentHandler(xml.sax.handler.ContentHandler):
-@@ -1201,24 +1203,24 @@ class NmapContentHandler(xml.sax.handler.ContentHandle
- self.skip_over = False
-
- self._start_elem_handlers = {
-- u"nmaprun": self._start_nmaprun,
-- u"host": self._start_host,
-- u"hosthint": self._start_hosthint,
-- u"status": self._start_status,
-- u"address": self._start_address,
-- u"hostname": self._start_hostname,
-- u"extraports": self._start_extraports,
-- u"port": self._start_port,
-- u"state": self._start_state,
-- u"service": self._start_service,
-- u"script": self._start_script,
-- u"osmatch": self._start_osmatch,
-- u"finished": self._start_finished,
-+ "nmaprun": self._start_nmaprun,
-+ "host": self._start_host,
-+ "hosthint": self._start_hosthint,
-+ "status": self._start_status,
-+ "address": self._start_address,
-+ "hostname": self._start_hostname,
-+ "extraports": self._start_extraports,
-+ "port": self._start_port,
-+ "state": self._start_state,
-+ "service": self._start_service,
-+ "script": self._start_script,
-+ "osmatch": self._start_osmatch,
-+ "finished": self._start_finished,
- }
- self._end_elem_handlers = {
-- u'host': self._end_host,
-- u"hosthint": self._end_hosthint,
-- u'port': self._end_port,
-+ 'host': self._end_host,
-+ "hosthint": self._end_hosthint,
-+ 'port': self._end_port,
- }
-
- def parent_element(self):
-@@ -1248,72 +1250,72 @@ class NmapContentHandler(xml.sax.handler.ContentHandle
- def _start_nmaprun(self, name, attrs):
- assert self.parent_element() is None
- if "start" in attrs:
-- start_timestamp = int(attrs.get(u"start"))
-+ start_timestamp = int(attrs.get("start"))
- self.scan.start_date = datetime.datetime.fromtimestamp(
- start_timestamp)
-- self.scan.scanner = attrs.get(u"scanner")
-- self.scan.args = attrs.get(u"args")
-- self.scan.version = attrs.get(u"version")
-+ self.scan.scanner = attrs.get("scanner")
-+ self.scan.args = attrs.get("args")
-+ self.scan.version = attrs.get("version")
-
- def _start_host(self, name, attrs):
-- assert self.parent_element() == u"nmaprun"
-+ assert self.parent_element() == "nmaprun"
- self.current_host = Host()
- self.scan.hosts.append(self.current_host)
-
- def _start_hosthint(self, name, attrs):
-- assert self.parent_element() == u"nmaprun"
-+ assert self.parent_element() == "nmaprun"
- self.skip_over = True
-
- def _start_status(self, name, attrs):
-- assert self.parent_element() == u"host"
-+ assert self.parent_element() == "host"
- assert self.current_host is not None
-- state = attrs.get(u"state")
-+ state = attrs.get("state")
- if state is None:
-- warn(u'%s element of host %s is missing the "state" attribute; '
-- 'assuming \unknown\.' % (
-+ warn('%s element of host %s is missing the "state" attribute; '
-+ 'assuming \\unknown\.' % (
- name, self.current_host.format_name()))
- return
- self.current_host.state = state
-
- def _start_address(self, name, attrs):
-- assert self.parent_element() == u"host"
-+ assert self.parent_element() == "host"
- assert self.current_host is not None
-- addr = attrs.get(u"addr")
-+ addr = attrs.get("addr")
- if addr is None:
-- warn(u'%s element of host %s is missing the "addr" '
-+ warn('%s element of host %s is missing the "addr" '
- 'attribute; skipping.' % (
- name, self.current_host.format_name()))
- return
-- addrtype = attrs.get(u"addrtype", u"ipv4")
-+ addrtype = attrs.get("addrtype", "ipv4")
- self.current_host.add_address(Address.new(addrtype, addr))
-
- def _start_hostname(self, name, attrs):
-- assert self.parent_element() == u"hostnames"
-+ assert self.parent_element() == "hostnames"
- assert self.current_host is not None
-- hostname = attrs.get(u"name")
-+ hostname = attrs.get("name")
- if hostname is None:
-- warn(u'%s element of host %s is missing the "name" '
-+ warn('%s element of host %s is missing the "name" '
- 'attribute; skipping.' % (
- name, self.current_host.format_name()))
- return
- self.current_host.add_hostname(hostname)
-
- def _start_extraports(self, name, attrs):
-- assert self.parent_element() == u"ports"
-+ assert self.parent_element() == "ports"
- assert self.current_host is not None
-- state = attrs.get(u"state")
-+ state = attrs.get("state")
- if state is None:
-- warn(u'%s element of host %s is missing the "state" '
-+ warn('%s element of host %s is missing the "state" '
- 'attribute; assuming "unknown".' % (
- name, self.current_host.format_name()))
- state = None
- if state in self.current_host.extraports:
-- warn(u'Duplicate extraports state "%s" in host %s.' % (
-+ warn('Duplicate extraports state "%s" in host %s.' % (
- state, self.current_host.format_name()))
-
-- count = attrs.get(u"count")
-+ count = attrs.get("count")
- if count is None:
-- warn(u'%s element of host %s is missing the "count" '
-+ warn('%s element of host %s is missing the "count" '
- 'attribute; assuming 0.' % (
- name, self.current_host.format_name()))
- count = 0
-@@ -1321,99 +1323,99 @@ class NmapContentHandler(xml.sax.handler.ContentHandle
- try:
- count = int(count)
- except ValueError:
-- warn(u"Can't convert extraports count \"%s\" "
-+ warn("Can't convert extraports count \"%s\" "
- "to an integer in host %s; assuming 0." % (
-- attrs[u"count"], self.current_host.format_name()))
-+ attrs["count"], self.current_host.format_name()))
- count = 0
- self.current_host.extraports[state] = count
-
- def _start_port(self, name, attrs):
-- assert self.parent_element() == u"ports"
-+ assert self.parent_element() == "ports"
- assert self.current_host is not None
-- portid_str = attrs.get(u"portid")
-+ portid_str = attrs.get("portid")
- if portid_str is None:
-- warn(u'%s element of host %s missing the "portid" '
-+ warn('%s element of host %s missing the "portid" '
- 'attribute; skipping.' % (
- name, self.current_host.format_name()))
- return
- try:
- portid = int(portid_str)
- except ValueError:
-- warn(u"Can't convert portid \"%s\" to an integer "
-+ warn("Can't convert portid \"%s\" to an integer "
- "in host %s; skipping port." % (
- portid_str, self.current_host.format_name()))
- return
-- protocol = attrs.get(u"protocol")
-+ protocol = attrs.get("protocol")
- if protocol is None:
-- warn(u'%s element of host %s missing the "protocol" '
-+ warn('%s element of host %s missing the "protocol" '
- 'attribute; skipping.' % (
- name, self.current_host.format_name()))
- return
- self.current_port = Port((portid, protocol))
-
- def _start_state(self, name, attrs):
-- assert self.parent_element() == u"port"
-+ assert self.parent_element() == "port"
- assert self.current_host is not None
- if self.current_port is None:
- return
- if "state" not in attrs:
-- warn(u'%s element of port %s is missing the "state" '
-+ warn('%s element of port %s is missing the "state" '
- 'attribute; assuming "unknown".' % (
- name, self.current_port.spec_string()))
- return
-- self.current_port.state = attrs[u"state"]
-+ self.current_port.state = attrs["state"]
- self.current_host.add_port(self.current_port)
-
- def _start_service(self, name, attrs):
-- assert self.parent_element() == u"port"
-+ assert self.parent_element() == "port"
- assert self.current_host is not None
- if self.current_port is None:
- return
-- self.current_port.service.name = attrs.get(u"name")
-- self.current_port.service.product = attrs.get(u"product")
-- self.current_port.service.version = attrs.get(u"version")
-- self.current_port.service.extrainfo = attrs.get(u"extrainfo")
-- self.current_port.service.tunnel = attrs.get(u"tunnel")
-+ self.current_port.service.name = attrs.get("name")
-+ self.current_port.service.product = attrs.get("product")
-+ self.current_port.service.version = attrs.get("version")
-+ self.current_port.service.extrainfo = attrs.get("extrainfo")
-+ self.current_port.service.tunnel = attrs.get("tunnel")
-
- def _start_script(self, name, attrs):
- result = ScriptResult()
-- result.id = attrs.get(u"id")
-+ result.id = attrs.get("id")
- if result.id is None:
-- warn(u'%s element missing the "id" attribute; skipping.' % name)
-+ warn('%s element missing the "id" attribute; skipping.' % name)
- return
-
-- result.output = attrs.get(u"output")
-+ result.output = attrs.get("output")
- if result.output is None:
-- warn(u'%s element missing the "output" attribute; skipping.'
-+ warn('%s element missing the "output" attribute; skipping.'
- % name)
- return
-- if self.parent_element() == u"prescript":
-+ if self.parent_element() == "prescript":
- self.scan.pre_script_results.append(result)
-- elif self.parent_element() == u"postscript":
-+ elif self.parent_element() == "postscript":
- self.scan.post_script_results.append(result)
-- elif self.parent_element() == u"hostscript":
-+ elif self.parent_element() == "hostscript":
- self.current_host.script_results.append(result)
-- elif self.parent_element() == u"port":
-+ elif self.parent_element() == "port":
- self.current_port.script_results.append(result)
- else:
-- warn(u"%s element not inside prescript, postscript, hostscript, "
-+ warn("%s element not inside prescript, postscript, hostscript, "
- "or port element; ignoring." % name)
- return
-
- def _start_osmatch(self, name, attrs):
-- assert self.parent_element() == u"os"
-+ assert self.parent_element() == "os"
- assert self.current_host is not None
- if "name" not in attrs:
-- warn(u'%s element of host %s is missing the "name" '
-+ warn('%s element of host %s is missing the "name" '
- 'attribute; skipping.' % (
- name, self.current_host.format_name()))
- return
-- self.current_host.os.append(attrs[u"name"])
-+ self.current_host.os.append(attrs["name"])
-
- def _start_finished(self, name, attrs):
-- assert self.parent_element() == u"runstats"
-+ assert self.parent_element() == "runstats"
- if "time" in attrs:
-- end_timestamp = int(attrs.get(u"time"))
-+ end_timestamp = int(attrs.get("time"))
- self.scan.end_date = datetime.datetime.fromtimestamp(end_timestamp)
-
- def _end_host(self, name):
-@@ -1435,23 +1437,23 @@ class XMLWriter (xml.sax.saxutils.XMLGenerator):
-
- def frag(self, frag):
- for node in frag.childNodes:
-- node.writexml(self.f, newl=u"\n")
-+ node.writexml(self.f, newl="\n")
-
- def frag_a(self, frag):
-- self.startElement(u"a", {})
-+ self.startElement("a", {})
- for node in frag.childNodes:
-- node.writexml(self.f, newl=u"\n")
-- self.endElement(u"a")
-+ node.writexml(self.f, newl="\n")
-+ self.endElement("a")
-
- def frag_b(self, frag):
-- self.startElement(u"b", {})
-+ self.startElement("b", {})
- for node in frag.childNodes:
-- node.writexml(self.f, newl=u"\n")
-- self.endElement(u"b")
-+ node.writexml(self.f, newl="\n")
-+ self.endElement("b")
-
-
- def usage():
-- print u"""\
-+ print("""\
- Usage: %s [option] FILE1 FILE2
- Compare two Nmap XML files and display a list of their differences.
- Differences include host state changes, port state changes, and changes to
-@@ -1461,7 +1463,7 @@ service and OS detection.
- -v, --verbose also show hosts and ports that haven't changed.
- --text display output in text format (default)
- --xml display output in XML format\
--""" % sys.argv[0]
-+""" % sys.argv[0])
-
- EXIT_EQUAL = 0
- EXIT_DIFFERENT = 1
-@@ -1469,8 +1471,8 @@ EXIT_ERROR = 2
-
-
- def usage_error(msg):
-- print >> sys.stderr, u"%s: %s" % (sys.argv[0], msg)
-- print >> sys.stderr, u"Try '%s -h' for help." % sys.argv[0]
-+ print("%s: %s" % (sys.argv[0], msg), file=sys.stderr)
-+ print("Try '%s -h' for help." % sys.argv[0], file=sys.stderr)
- sys.exit(EXIT_ERROR)
-
-
-@@ -1481,7 +1483,7 @@ def main():
- try:
- opts, input_filenames = getopt.gnu_getopt(
- sys.argv[1:], "hv", ["help", "text", "verbose", "xml"])
-- except getopt.GetoptError, e:
-+ except getopt.GetoptError as e:
- usage_error(e.msg)
- for o, a in opts:
- if o == "-h" or o == "--help":
-@@ -1491,15 +1493,15 @@ def main():
- verbose = True
- elif o == "--text":
- if output_format is not None and output_format != "text":
-- usage_error(u"contradictory output format options.")
-+ usage_error("contradictory output format options.")
- output_format = "text"
- elif o == "--xml":
- if output_format is not None and output_format != "xml":
-- usage_error(u"contradictory output format options.")
-+ usage_error("contradictory output format options.")
- output_format = "xml"
-
- if len(input_filenames) != 2:
-- usage_error(u"need exactly two input filenames.")
-+ usage_error("need exactly two input filenames.")
-
- if output_format is None:
- output_format = "text"
-@@ -1512,8 +1514,8 @@ def main():
- scan_a.load_from_file(filename_a)
- scan_b = Scan()
- scan_b.load_from_file(filename_b)
-- except IOError, e:
-- print >> sys.stderr, u"Can't open file: %s" % str(e)
-+ except IOError as e:
-+ print("Can't open file: %s" % str(e), file=sys.stderr)
- sys.exit(EXIT_ERROR)
-
- if output_format == "text":
Index: net/nmap/patches/patch-ndiff_ndifftest_py
===================================================================
RCS file: net/nmap/patches/patch-ndiff_ndifftest_py
diff -N net/nmap/patches/patch-ndiff_ndifftest_py
--- net/nmap/patches/patch-ndiff_ndifftest_py 18 Feb 2025 21:30:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,207 +0,0 @@
-apply 2to3
-
-Index: ndiff/ndifftest.py
---- ndiff/ndifftest.py.orig
-+++ ndiff/ndifftest.py
-@@ -22,7 +22,7 @@ for x in dir(ndiff):
- sys.dont_write_bytecode = dont_write_bytecode
- del dont_write_bytecode
-
--import StringIO
-+import io
-
-
- class scan_test(unittest.TestCase):
-@@ -52,7 +52,7 @@ class scan_test(unittest.TestCase):
- scan.load_from_file("test-scans/single.xml")
- host = scan.hosts[0]
- self.assertEqual(len(host.ports), 5)
-- self.assertEqual(host.extraports.items(), [("filtered", 95)])
-+ self.assertEqual(list(host.extraports.items()), [("filtered", 95)])
-
- def test_extraports_multi(self):
- """Test that the correct number of known ports is returned when there
-@@ -68,9 +68,9 @@ class scan_test(unittest.TestCase):
- """Test that nmaprun information is recorded."""
- scan = Scan()
- scan.load_from_file("test-scans/empty.xml")
-- self.assertEqual(scan.scanner, u"nmap")
-- self.assertEqual(scan.version, u"4.90RC2")
-- self.assertEqual(scan.args, u"nmap -oX empty.xml -p 1-100")
-+ self.assertEqual(scan.scanner, "nmap")
-+ self.assertEqual(scan.version, "4.90RC2")
-+ self.assertEqual(scan.args, "nmap -oX empty.xml -p 1-100")
-
- def test_addresses(self):
- """Test that addresses are recorded."""
-@@ -84,7 +84,7 @@ class scan_test(unittest.TestCase):
- scan = Scan()
- scan.load_from_file("test-scans/simple.xml")
- host = scan.hosts[0]
-- self.assertEqual(host.hostnames, [u"scanme.nmap.org"])
-+ self.assertEqual(host.hostnames, ["scanme.nmap.org"])
-
- def test_os(self):
- """Test that OS information is recorded."""
-@@ -99,7 +99,7 @@ class scan_test(unittest.TestCase):
- scan.load_from_file("test-scans/complex.xml")
- host = scan.hosts[0]
- self.assertTrue(len(host.script_results) > 0)
-- self.assertTrue(len(host.ports[(22, u"tcp")].script_results) > 0)
-+ self.assertTrue(len(host.ports[(22, "tcp")].script_results) > 0)
-
- # This test is commented out because Nmap XML doesn't store any information
- # about down hosts, not even the fact that they are down. Recovering the list
-@@ -128,16 +128,16 @@ class host_test(unittest.TestCase):
-
- def test_format_name(self):
- h = Host()
-- self.assertTrue(isinstance(h.format_name(), basestring))
-- h.add_address(IPv4Address(u"127.0.0.1"))
-- self.assertTrue(u"127.0.0.1" in h.format_name())
-+ self.assertTrue(isinstance(h.format_name(), str))
-+ h.add_address(IPv4Address("127.0.0.1"))
-+ self.assertTrue("127.0.0.1" in h.format_name())
- h.add_address(IPv6Address("::1"))
-- self.assertTrue(u"127.0.0.1" in h.format_name())
-- self.assertTrue(u"::1" in h.format_name())
-- h.add_hostname(u"localhost")
-- self.assertTrue(u"127.0.0.1" in h.format_name())
-- self.assertTrue(u"::1" in h.format_name())
-- self.assertTrue(u"localhost" in h.format_name())
-+ self.assertTrue("127.0.0.1" in h.format_name())
-+ self.assertTrue("::1" in h.format_name())
-+ h.add_hostname("localhost")
-+ self.assertTrue("127.0.0.1" in h.format_name())
-+ self.assertTrue("::1" in h.format_name())
-+ self.assertTrue("localhost" in h.format_name())
-
- def test_empty_get_port(self):
- h = Host()
-@@ -197,8 +197,8 @@ class host_test(unittest.TestCase):
- h = s.hosts[0]
- self.assertEqual(len(h.ports), 5)
- self.assertEqual(len(h.extraports), 1)
-- self.assertEqual(h.extraports.keys()[0], u"filtered")
-- self.assertEqual(h.extraports.values()[0], 95)
-+ self.assertEqual(list(h.extraports.keys())[0], "filtered")
-+ self.assertEqual(list(h.extraports.values())[0], 95)
- self.assertEqual(h.state, "up")
-
-
-@@ -241,13 +241,13 @@ class port_test(unittest.TestCase):
- """Test the Port class."""
- def test_spec_string(self):
- p = Port((10, "tcp"))
-- self.assertEqual(p.spec_string(), u"10/tcp")
-+ self.assertEqual(p.spec_string(), "10/tcp")
- p = Port((100, "ip"))
-- self.assertEqual(p.spec_string(), u"100/ip")
-+ self.assertEqual(p.spec_string(), "100/ip")
-
- def test_state_string(self):
- p = Port((10, "tcp"))
-- self.assertEqual(p.state_string(), u"unknown")
-+ self.assertEqual(p.state_string(), "unknown")
-
-
- class service_test(unittest.TestCase):
-@@ -255,47 +255,47 @@ class service_test(unittest.TestCase):
- def test_compare(self):
- """Test that services with the same contents compare equal."""
- a = Service()
-- a.name = u"ftp"
-- a.product = u"FooBar FTP"
-- a.version = u"1.1.1"
-- a.tunnel = u"ssl"
-+ a.name = "ftp"
-+ a.product = "FooBar FTP"
-+ a.version = "1.1.1"
-+ a.tunnel = "ssl"
- self.assertEqual(a, a)
- b = Service()
-- b.name = u"ftp"
-- b.product = u"FooBar FTP"
-- b.version = u"1.1.1"
-- b.tunnel = u"ssl"
-+ b.name = "ftp"
-+ b.product = "FooBar FTP"
-+ b.version = "1.1.1"
-+ b.tunnel = "ssl"
- self.assertEqual(a, b)
-- b.name = u"http"
-+ b.name = "http"
- self.assertNotEqual(a, b)
- c = Service()
- self.assertNotEqual(a, c)
-
- def test_tunnel(self):
- serv = Service()
-- serv.name = u"http"
-- serv.tunnel = u"ssl"
-- self.assertEqual(serv.name_string(), u"ssl/http")
-+ serv.name = "http"
-+ serv.tunnel = "ssl"
-+ self.assertEqual(serv.name_string(), "ssl/http")
-
- def test_version_string(self):
- serv = Service()
-- serv.product = u"FooBar"
-+ serv.product = "FooBar"
- self.assertTrue(len(serv.version_string()) > 0)
- serv = Service()
-- serv.version = u"1.2.3"
-+ serv.version = "1.2.3"
- self.assertTrue(len(serv.version_string()) > 0)
- serv = Service()
-- serv.extrainfo = u"misconfigured"
-+ serv.extrainfo = "misconfigured"
- self.assertTrue(len(serv.version_string()) > 0)
- serv = Service()
-- serv.product = u"FooBar"
-- serv.version = u"1.2.3"
-+ serv.product = "FooBar"
-+ serv.version = "1.2.3"
- # Must match Nmap output.
- self.assertEqual(serv.version_string(),
-- u"%s %s" % (serv.product, serv.version))
-- serv.extrainfo = u"misconfigured"
-+ "%s %s" % (serv.product, serv.version))
-+ serv.extrainfo = "misconfigured"
- self.assertEqual(serv.version_string(),
-- u"%s %s (%s)" % (serv.product, serv.version, serv.extrainfo))
-+ "%s %s (%s)" % (serv.product, serv.version, serv.extrainfo))
-
-
- class ScanDiffSub(ScanDiff):
-@@ -703,7 +703,7 @@ class scan_diff_xml_test(unittest.TestCase):
- a.load_from_file("test-scans/empty.xml")
- b = Scan()
- b.load_from_file("test-scans/simple.xml")
-- f = StringIO.StringIO()
-+ f = io.StringIO()
- self.scan_diff = ScanDiffXML(a, b, f)
- self.scan_diff.output()
- self.xml = f.getvalue()
-@@ -712,8 +712,8 @@ class scan_diff_xml_test(unittest.TestCase):
- def test_well_formed(self):
- try:
- document = xml.dom.minidom.parseString(self.xml)
-- except Exception, e:
-- self.fail(u"Parsing XML diff output caused the exception: %s"
-+ except Exception as e:
-+ self.fail("Parsing XML diff output caused the exception: %s"
- % str(e))
-
-
-@@ -739,8 +739,8 @@ def host_apply_diff(host, diff):
- host.os = diff.host_b.os[:]
-
- if diff.extraports_changed:
-- for state in host.extraports.keys():
-- for port in host.ports.values():
-+ for state in list(host.extraports.keys()):
-+ for port in list(host.ports.values()):
- if port.state == state:
- del host.ports[port.spec]
- host.extraports = diff.host_b.extraports.copy()
Index: net/nmap/patches/patch-ndiff_scripts_ndiff
===================================================================
RCS file: net/nmap/patches/patch-ndiff_scripts_ndiff
diff -N net/nmap/patches/patch-ndiff_scripts_ndiff
--- net/nmap/patches/patch-ndiff_scripts_ndiff 18 Feb 2025 21:30:55 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,27 +0,0 @@
-apply 2to3
-
-Index: ndiff/scripts/ndiff
---- ndiff/scripts/ndiff.orig
-+++ ndiff/scripts/ndiff
-@@ -67,15 +67,15 @@ if INSTALL_LIB is not None and is_secure_dir(INSTALL_L
-
- try:
- import ndiff
--except ImportError, e:
-- print >> sys.stderr, """\
-+except ImportError as e:
-+ print("""\
- Could not import the ndiff module: %s.
--I checked in these directories:""" % repr(e.message)
-+I checked in these directories:""" % repr(e.message), file=sys.stderr)
- for dir in sys.path:
-- print >> sys.stderr, " %s" % dir
-- print >> sys.stderr, """\
-+ print(" %s" % dir, file=sys.stderr)
-+ print("""\
- If you installed Ndiff in another directory, you may have to add the
--modules directory to the PYTHONPATH environment variable."""
-+modules directory to the PYTHONPATH environment variable.""", file=sys.stderr)
- sys.exit(1)
-
- import ndiff
Index: net/nmap/patches/patch-ndiff_setup_py
===================================================================
RCS file: net/nmap/patches/patch-ndiff_setup_py
diff -N net/nmap/patches/patch-ndiff_setup_py
--- net/nmap/patches/patch-ndiff_setup_py 18 Feb 2025 21:30:55 -0000 1.8
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,71 +0,0 @@
-apply 2to3 and additional fixes
-
-Index: ndiff/setup.py
---- ndiff/setup.py.orig
-+++ ndiff/setup.py
-@@ -94,7 +94,7 @@ class checked_install(distutils.command.install.instal
- self.saved_prefix = sys.prefix
- try:
- distutils.command.install.install.finalize_options(self)
-- except distutils.errors.DistutilsPlatformError, e:
-+ except distutils.errors.DistutilsPlatformError as e:
- raise distutils.errors.DistutilsPlatformError(str(e) + """
- Installing your distribution's python-dev package may solve this problem.""")
-
-@@ -227,7 +227,7 @@ for dir in dirs:
- uninstaller_file.close()
-
- # Set exec bit for uninstaller
-- mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0555) & 07777
-+ mode = ((os.stat(uninstaller_filename)[ST_MODE]) | 0o555) & 0o7777
- os.chmod(uninstaller_filename, mode)
-
- def write_installed_files(self):
-@@ -241,7 +241,7 @@ for dir in dirs:
- with open(INSTALLED_FILES_NAME, "w") as f:
- for output in self.get_installed_files():
- assert "\n" not in output
-- print >> f, output
-+ print(output, file=f)
-
-
- class my_uninstall(distutils.cmd.Command):
-@@ -263,7 +263,7 @@ class my_uninstall(distutils.cmd.Command):
- # Read the list of installed files.
- try:
- f = open(INSTALLED_FILES_NAME, "r")
-- except IOError, e:
-+ except IOError as e:
- if e.errno == errno.ENOENT:
- log.error("Couldn't open the installation record '%s'. "
- "Have you installed yet?" % INSTALLED_FILES_NAME)
-@@ -286,7 +286,7 @@ class my_uninstall(distutils.cmd.Command):
- try:
- if not self.dry_run:
- os.remove(file)
-- except OSError, e:
-+ except OSError as e:
- log.error(str(e))
- # Delete the directories. First reverse-sort the normalized paths by
- # length so that child directories are deleted before their parents.
-@@ -297,16 +297,16 @@ class my_uninstall(distutils.cmd.Command):
- log.info("Removing the directory '%s'." % dir)
- if not self.dry_run:
- os.rmdir(dir)
-- except OSError, e:
-+ except OSError as e:
- if e.errno == errno.ENOTEMPTY:
- log.info("Directory '%s' not empty; not removing." % dir)
- else:
- log.error(str(e))
-
-
--distutils.core.setup(name=u"ndiff", scripts=[u"scripts/ndiff"],
-- py_modules=[u"ndiff"],
-- data_files=[(u"share/man/man1", [u"docs/ndiff.1"])],
-+distutils.core.setup(name="ndiff", scripts=["scripts/ndiff"],
-+ py_modules=["ndiff"],
-+ data_files=[("man/man1", ["docs/ndiff.1"])],
- cmdclass={
- "install_egg_info": null_command,
- "install": checked_install,
Index: net/nmap/patches/patch-nmap_dns_cc
===================================================================
RCS file: /cvs/ports/net/nmap/patches/patch-nmap_dns_cc,v
diff -u -p -r1.3 patch-nmap_dns_cc
--- net/nmap/patches/patch-nmap_dns_cc 7 May 2024 15:19:43 -0000 1.3
+++ net/nmap/patches/patch-nmap_dns_cc 3 Mar 2026 20:41:01 -0000
@@ -5,7 +5,7 @@ https://github.com/nmap/nmap/commit/3ada
Index: nmap_dns.cc
--- nmap_dns.cc.orig
+++ nmap_dns.cc
-@@ -1352,7 +1352,7 @@ bool DNS::Factory::ptrToIp(const std::string &ptr, soc
+@@ -1671,7 +1671,7 @@ bool DNS::Factory::ptrToIp(const std::string &ptr, soc
memset(&ip, 0, sizeof(sockaddr_storage));

// Check whether the name ends with the IPv4 PTR domain
@@ -14,7 +14,7 @@ Index: nmap_dns.cc
{
struct sockaddr_in *ip4 = (struct sockaddr_in *)&ip;
static const u8 place_value[] = {1, 10, 100};
-@@ -1387,7 +1387,7 @@ bool DNS::Factory::ptrToIp(const std::string &ptr, soc
+@@ -1706,7 +1706,7 @@ bool DNS::Factory::ptrToIp(const std::string &ptr, soc
ip.ss_family = AF_INET;
}
// If not, check IPv6
Index: net/nmap/patches/patch-nping_Crypto_cc
===================================================================
RCS file: /cvs/ports/net/nmap/patches/patch-nping_Crypto_cc,v
diff -u -p -r1.2 patch-nping_Crypto_cc
--- net/nmap/patches/patch-nping_Crypto_cc 11 Mar 2022 19:46:31 -0000 1.2
+++ net/nmap/patches/patch-nping_Crypto_cc 3 Mar 2026 20:41:01 -0000
@@ -1,12 +1,12 @@
Index: nping/Crypto.cc
--- nping/Crypto.cc.orig
+++ nping/Crypto.cc
-@@ -70,7 +70,7 @@
+@@ -69,7 +69,7 @@
#include <openssl/evp.h>
#include <openssl/err.h>

-#if (OPENSSL_VERSION_NUMBER >= 0x10100000L) && !defined LIBRESSL_VERSION_NUMBER
+#if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
#define HAVE_OPAQUE_EVP_PKEY 1
- #define FUNC_EVP_MD_CTX_init EVP_MD_CTX_reset
- #define FUNC_EVP_MD_CTX_cleanup EVP_MD_CTX_reset
+ #else
+ #define EVP_MD_CTX_new EVP_MD_CTX_create
Index: net/nmap/patches/patch-nping_EchoServer_cc
===================================================================
RCS file: /cvs/ports/net/nmap/patches/patch-nping_EchoServer_cc,v
diff -u -p -r1.7 patch-nping_EchoServer_cc
--- net/nmap/patches/patch-nping_EchoServer_cc 11 Mar 2022 19:46:31 -0000 1.7
+++ net/nmap/patches/patch-nping_EchoServer_cc 3 Mar 2026 20:41:01 -0000
@@ -3,7 +3,7 @@ Ambiguous bind(2) call.
Index: nping/EchoServer.cc
--- nping/EchoServer.cc.orig
+++ nping/EchoServer.cc
-@@ -213,12 +213,12 @@ int EchoServer::nep_listen_socket(){
+@@ -212,12 +212,12 @@ int EchoServer::nep_listen_socket(){
server_addr6.sin6_len = sizeof(struct sockaddr_in6);

No comments:

Post a Comment