On Sun, Feb 14, 2021 at 09:32:06AM +0100, Claudio Jeker wrote:
> Here is an update to x11/driftnet. Switch to a github repo that seems to
> include some of our fixes and is a bit more current. Drop maintainer since
> I don't think this program is that useful anymore. Most websites are
> using secure transport now and so driftnet is rather useless.
>
> What do other people think?
Regarding content extraction modulo pretty display functions, does this
port do anything which Wireshark cannot do?
I've applied your diff an ran `make install' on my X230 to test the
program:
$ driftnet
Sun Feb 14 12:26:29 2021 [driftnet] error: pcap_activate: You don't
have permission to capture on that device
Segmentation fault (core dumped)
$ egdb --quiet -batch -ex bt driftnet ./driftnet.core
[New process 324491]
Core was generated by `driftnet'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0 pthread_cancel (thread=0x0) at /usr/src/lib/librthread/rthread.c:430
430 struct tib *tib = thread->tib;
#0 pthread_cancel (thread=0x0) at /usr/src/lib/librthread/rthread.c:430
#1 0x00000f1078010e5a in ?? ()
#2 0x00000f1078009d61 in ?? ()
#3 0x00000f107800af7f in ?? ()
#4 0x00000f1078009dec in ?? ()
#5 0x00000f1078009371 in ?? ()
#6 0x0000000000000000 in ?? ()
Even `driftnet --help' dumps core (only `-h' is recognised).
Dropping to an unprivileged user as per `-Z' only works if that user is
also able to use X:
$ doas driftnet -v -i trunk0 -Z _tcpdump
Sun Feb 14 12:36:00 2021 [driftnet] info: listening on trunk0 in
promiscuous mode
Sun Feb 14 12:36:00 2021 [driftnet] info: dropped privileges to user
_tcpdump
Sun Feb 14 12:36:00 2021 [driftnet] info: using temporary file
directory /tmp//driftnet-8Idoys
Sun Feb 14 12:36:00 2021 [driftnet] info: started display child, pid
90930
No protocol specified
(driftnet:90930): Gtk-WARNING **: 12:36:00.501: cannot open display: :0
Sun Feb 14 12:36:01 2021 [driftnet] info: child process 90930 exited
with status 1
It also shits its pants on invalid filters:
$ doas driftnet -v -i trunk0 -Z _tcpdump foo
Sun Feb 14 12:41:01 2021 [driftnet] error: pcap_compile: syntax error
in filter expression
Segmentation fault
This is the log from opening http://www.ex-parrot.com/~chris/driftnet/
and http://www.ex-parrot.com/~chris/driftnet/screenshot.jpg directly in
a browser; I fail to see the JPEG image being extracted/displayed/etc.
$ doas driftnet -v -i trunk0 -Z kn
Sun Feb 14 12:32:15 2021 [driftnet] info: listening on trunk0 in
promiscuous mode
Sun Feb 14 12:32:15 2021 [driftnet] info: using temporary file
directory /tmp//driftnet-pySkMn
Sun Feb 14 12:32:15 2021 [driftnet] info: started display child, pid
42009
Sun Feb 14 12:32:24 2021 [driftnet] info: new connection:
192.168.2.199:23160 -> 93.93.130.166:80
Sun Feb 14 12:32:24 2021 [driftnet] info: new connection:
93.93.130.166:80 -> 192.168.2.199:23160
Sun Feb 14 12:32:29 2021 [driftnet] info: connection closing:
93.93.130.166:80 -> 192.168.2.199:23160, 214 bytes transferred
^C
Sun Feb 14 12:32:46 2021 [driftnet] info: caught signal 2
How about you just remove this port? OK kn to do so, but I'll gladly
take care of this myself with your OK as well.
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/x11/driftnet/Makefile,v
> retrieving revision 1.16
> diff -u -p -r1.16 Makefile
> --- Makefile 12 Jul 2019 20:51:09 -0000 1.16
> +++ Makefile 14 Feb 2021 08:26:07 -0000
> @@ -1,36 +1,35 @@
> # $OpenBSD: Makefile,v 1.16 2019/07/12 20:51:09 sthen Exp $
>
> -COMMENT= network sniffer that grabs and displays images
> +COMMENT = network sniffer that grabs and displays images
>
> -VERSION = 1.0
> -DISTNAME= driftnet_${VERSION}.orig
> -PKGNAME= driftnet-${VERSION}
> -REVISION= 1
> -CATEGORIES= x11
> +VERSION = 1.2.0
> +DISTNAME = driftnet-${VERSION}
>
> -HOMEPAGE= http://www.ex-parrot.com/~chris/driftnet/
> +GH_ACCOUNT = deiv
> +GH_PROJECT = driftnet
> +GH_TAGNAME = v1.2.0
There is https://github.com/deiv/driftnet/releases/tag/v1.3.0 available.
> -MAINTAINER= Claudio Jeker <[email protected]>
> +CATEGORIES = x11
> +
> +HOMEPAGE = http://www.ex-parrot.com/~chris/driftnet/
Has working HTTPS.
> # GPLv2+
> PERMIT_PACKAGE= Yes
>
> -MASTER_SITES= https://launchpad.net/ubuntu/+archive/primary/+files/
> -
> WANTLIB += c pcap gif png pthread jpeg
> WANTLIB += glib-2.0 gobject-2.0 gdk-x11-2.0 gtk-x11-2.0
>
> -LIB_DEPENDS= graphics/giflib \
> +LIB_DEPENDS = graphics/giflib \
> graphics/jpeg \
> + www/libwebsockets \
> x11/gtk+2
>
> -NO_TEST= Yes
> -
> -WRKDIST = ${WRKDIR}/${PKGNAME}
> +NO_TEST = Yes
>
> AUTOCONF_VERSION = 2.69
> -CONFIGURE_STYLE = autoconf
> -CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include/gtk-2.0" \
> +AUTOMAKE_VERSION = 1.16
> +CONFIGURE_STYLE = autoreconf
> +CONFIGURE_ENV = CPPFLAGS="-I${LOCALBASE}/include
> -I${LOCALBASE}/include/gtk-2.0" \
> LDFLAGS="-L${LOCALBASE}/lib -L${X11BASE}/lib"
>
> .include <bsd.port.mk>
> Index: distinfo
> ===================================================================
> RCS file: /cvs/ports/x11/driftnet/distinfo,v
> retrieving revision 1.2
> diff -u -p -r1.2 distinfo
> --- distinfo 24 Jun 2013 16:48:43 -0000 1.2
> +++ distinfo 10 Oct 2019 08:30:15 -0000
> @@ -1,2 +1,2 @@
> -SHA256 (driftnet_1.0.orig.tar.gz) =
> suZ17EyO7BJhmNQBCIC1edcozxflIQbX9A8KE1AA6qc=
> -SIZE (driftnet_1.0.orig.tar.gz) = 151184
> +SHA256 (driftnet-1.2.0.tar.gz) = TXuIjatzdB+YpBRDMDa2YdiG9uRIZmT+jPSRNEZlob8=
> +SIZE (driftnet-1.2.0.tar.gz) = 144356
> Index: patches/patch-Makefile_am
> ===================================================================
> RCS file: patches/patch-Makefile_am
> diff -N patches/patch-Makefile_am
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-Makefile_am 10 Oct 2019 08:37:17 -0000
> @@ -0,0 +1,21 @@
> +$OpenBSD$
> +
> +Index: Makefile.am
> +--- Makefile.am.orig
> ++++ Makefile.am
> +@@ -4,13 +4,13 @@ SUBDIRS = src
> + dist_doc_DATA = README.md TODO
> + EXTRA_DIST = driftnet.1.in CREDITS Changelog
> +
> +-MANPAGE = driftnet.1.gz
> ++MANPAGE = driftnet.1
> + MAN1DIR = $(DESTDIR)$(mandir)/man1/
> +
> + clean-local:
> + rm -f $(MANPAGE)
> +
> + install-data-local: driftnet.1.in
> +- cat $(srcdir)/driftnet.1.in | sed s/@*VERSION@*/$(VERSION)/ |
> GZIP=$(GZIP_ENV) gzip > $(MANPAGE)
> ++ cat $(srcdir)/driftnet.1.in | sed s/@*VERSION@*/$(VERSION)/ > $(MANPAGE)
> + $(MKDIR_P) $(MAN1DIR)
> + $(INSTALL_DATA) $(MANPAGE) $(MAN1DIR) || exit $$?
> Index: patches/patch-Makefile_in
> ===================================================================
> RCS file: patches/patch-Makefile_in
> diff -N patches/patch-Makefile_in
> --- patches/patch-Makefile_in 24 Jun 2013 16:48:43 -0000 1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,21 +0,0 @@
> -$OpenBSD: patch-Makefile_in,v 1.1 2013/06/24 16:48:43 sebastia Exp $
> ---- Makefile.in.orig Sun May 12 18:33:18 2013
> -+++ Makefile.in Fri Jun 21 09:38:27 2013
> -@@ -258,7 +258,7 @@ top_srcdir = @top_srcdir@
> - SUBDIRS = src
> - dist_doc_DATA = README TODO
> - EXTRA_DIST = driftnet.1.in CHANGES CREDITS
> --MANPAGE = driftnet.1.gz
> -+MANPAGE = driftnet.1
> - MAN1DIR = $(DESTDIR)$(mandir)/man1/
> - all: all-recursive
> -
> -@@ -773,7 +773,7 @@ clean-local:
> - rm -f $(MANPAGE)
> -
> - install-data-local: driftnet.1.in
> -- cat $(srcdir)/driftnet.1.in | sed s/@*VERSION@*/$(VERSION)/ |
> GZIP=$(GZIP_ENV) gzip > $(MANPAGE)
> -+ cat $(srcdir)/driftnet.1.in | sed s/@*VERSION@*/$(VERSION)/ > $(MANPAGE)
> - $(MKDIR_P) $(MAN1DIR)
> - $(INSTALL_DATA) $(MANPAGE) $(MAN1DIR) || exit $$?
> -
> Index: patches/patch-configure_ac
> ===================================================================
> RCS file: /cvs/ports/x11/driftnet/patches/patch-configure_ac,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-configure_ac
> --- patches/patch-configure_ac 24 Jun 2013 16:48:43 -0000 1.1
> +++ patches/patch-configure_ac 10 Oct 2019 08:55:39 -0000
> @@ -2,9 +2,19 @@ $OpenBSD: patch-configure_ac,v 1.1 2013/
>
> allow passing CFLAGS correctly
>
> ---- configure.ac.orig Sun Jun 23 09:25:31 2013
> -+++ configure.ac Sun Jun 23 09:25:53 2013
> -@@ -24,11 +24,6 @@ AC_ARG_ENABLE([debug],
> +Index: configure.ac
> +--- configure.ac.orig
> ++++ configure.ac
> +@@ -22,7 +22,7 @@ build_linux=no
> + build_mac=no
> +
> + case "${host_os}" in
> +- linux*)
> ++ linux*|openbsd*)
> + build_linux=yes
> + ;;
> + cygwin*|mingw*)
> +@@ -68,11 +68,6 @@ AC_ARG_ENABLE([debug],
> ,
> [enable_debug=yes])
>
> Index: patches/patch-src_display_gif_c
> ===================================================================
> RCS file: patches/patch-src_display_gif_c
> diff -N patches/patch-src_display_gif_c
> --- patches/patch-src_display_gif_c 28 Mar 2015 16:01:55 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,30 +0,0 @@
> -$OpenBSD: patch-src_display_gif_c,v 1.2 2015/03/28 16:01:55 sthen Exp $
> ---- src/display/gif.c.orig Sun May 12 16:16:43 2013
> -+++ src/display/gif.c Sat Mar 28 15:57:39 2015
> -@@ -22,7 +22,7 @@
> - */
> - int gif_load_hdr(img I) {
> - GifFileType *g;
> -- g = I->us = DGifOpenFileHandle(fileno(I->fp));
> -+ g = I->us = DGifOpenFileHandle(fileno(I->fp), NULL);
> - if (!I->us) {
> - I->err = IE_HDRFORMAT;
> - return 0;
> -@@ -38,7 +38,7 @@ int gif_load_hdr(img I) {
> - * Abort loading a GIF file after the header is done.
> - */
> - int gif_abort_load(img I) {
> -- DGifCloseFile((GifFileType*)I->us);
> -+ DGifCloseFile((GifFileType*)I->us, NULL);
> - return 1;
> - }
> -
> -@@ -116,7 +116,7 @@ int gif_load_img(img I) {
> - ret = 1;
> - fail:
> -
> -- DGifCloseFile(g);
> -+ DGifCloseFile(g, NULL);
> -
> - return ret;
> - }
> Index: patches/patch-src_display_png_c
> ===================================================================
> RCS file: patches/patch-src_display_png_c
> diff -N patches/patch-src_display_png_c
> --- patches/patch-src_display_png_c 24 Jun 2013 16:48:43 -0000 1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,19 +0,0 @@
> -$OpenBSD: patch-src_display_png_c,v 1.1 2013/06/24 16:48:43 sebastia Exp $
> -
> -png_set_gray_1_2_4_to_8 doesn't seem to exist in newer
> -png anymore
> -
> ---- src/display/png.c.orig Fri Jun 21 09:29:56 2013
> -+++ src/display/png.c Fri Jun 21 09:30:09 2013
> -@@ -132,9 +132,9 @@ int png_load_img(img I) {
> - /* Convert greyscale images to 8-bit RGB */
> - if (color_type == PNG_COLOR_TYPE_GRAY ||
> - color_type == PNG_COLOR_TYPE_GRAY_ALPHA) {
> -- if (bit_depth < 8) {
> -+ /* if (bit_depth < 8) {
> - png_set_gray_1_2_4_to_8(png_ptr);
> -- }
> -+ } */
> - png_set_gray_to_rgb(png_ptr);
> - }
> -
> Index: patches/patch-src_http_display_httpd_c
> ===================================================================
> RCS file: patches/patch-src_http_display_httpd_c
> diff -N patches/patch-src_http_display_httpd_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_http_display_httpd_c 10 Oct 2019 09:04:25 -0000
> @@ -0,0 +1,15 @@
> +$OpenBSD$
> +
> +Requires pthread to compile
> +
> +Index: src/http_display/httpd.c
> +--- src/http_display/httpd.c.orig
> ++++ src/http_display/httpd.c
> +@@ -11,6 +11,7 @@
> + #include <config.h>
> + #endif
> +
> ++#include <pthread.h>
> + #include <libwebsockets.h>
> + #include <string.h>
> + #include <signal.h>
> Index: patches/patch-src_layer2_c
> ===================================================================
> RCS file: /cvs/ports/x11/driftnet/patches/patch-src_layer2_c,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-src_layer2_c
> --- patches/patch-src_layer2_c 24 Jun 2013 16:48:43 -0000 1.1
> +++ patches/patch-src_layer2_c 10 Oct 2019 09:12:32 -0000
> @@ -3,33 +3,25 @@ $OpenBSD: patch-src_layer2_c,v 1.1 2013/
> include the right headers, and define a struct ethhdr
> like its available on Linux
>
> ---- src/layer2.c.orig Fri Jun 21 08:58:51 2013
> -+++ src/layer2.c Fri Jun 21 09:12:06 2013
> -@@ -3,7 +3,10 @@
> +Index: src/layer2.c
> +--- src/layer2.c.orig
> ++++ src/layer2.c
> +@@ -9,7 +9,8 @@
> +
> #include <string.h>
> - #include <assert.h>
>
> --#include <netinet/ether.h>
> -+//#include <netinet/ether.h>
> +-#ifdef __FreeBSD__
> ++#if defined(__FreeBSD__) || defined(__OpenBSD__)
> +#include <sys/types.h>
> -+#include <netinet/in_systm.h>
> -+#include <netinet/in.h>
> - #include <netinet/ip.h>
> - #include <netinet/ip6.h>
> -
> -@@ -11,6 +14,15 @@
> -
> - #include "log.h"
> - #include "layer2.h"
> -+
> -+#define ETH_P_IP 0x0800
> -+#define ETH_P_IPV6 0x86DD
> -+#define ETH_ALEN 6
> -+struct ethhdr {
> -+ unsigned char h_dest[ETH_ALEN];
> -+ unsigned char h_source[ETH_ALEN];
> -+ u_int16_t h_proto;
> -+} __attribute__((packed));
> + #include <netinet/in_systm.h>
> + #include <netinet/in.h>
> + #else
> +@@ -24,7 +25,7 @@
> + /*
> + * Freebsd and Cygwin doesn't define 'ethhdr'
> + */
> +-#if defined(__FreeBSD__) || defined(__CYGWIN__)
> ++#if defined(__FreeBSD__) || defined(__CYGWIN__) || defined(__OpenBSD__)
>
> - int handle_link_layer(datalink_info_t *info, const u_char *pkt, uint8_t
> *nextproto,
> - int *offsetnext)
> + #define ETH_ALEN 6 /* Octets in one ethernet addr
> */
> + #define ETH_P_IP 0x0800 /* Internet Protocol packet */
> Index: patches/patch-src_layer3_c
> ===================================================================
> RCS file: /cvs/ports/x11/driftnet/patches/patch-src_layer3_c,v
> retrieving revision 1.1
> diff -u -p -r1.1 patch-src_layer3_c
> --- patches/patch-src_layer3_c 24 Jun 2013 16:48:43 -0000 1.1
> +++ patches/patch-src_layer3_c 10 Oct 2019 08:37:13 -0000
> @@ -2,11 +2,12 @@ $OpenBSD: patch-src_layer3_c,v 1.1 2013/
>
> import right headers
>
> ---- src/layer3.c.orig Fri Jun 21 09:12:25 2013
> -+++ src/layer3.c Fri Jun 21 09:22:48 2013
> -@@ -3,8 +3,12 @@
> - #include <string.h>
> - #include <assert.h>
> +Index: src/layer3.c
> +--- src/layer3.c.orig
> ++++ src/layer3.c
> +@@ -16,8 +16,12 @@
> + #include <sys/socket.h>
> + #endif
>
> +#include <sys/types.h>
> +#include <netinet/in_systm.h>
> Index: patches/patch-src_packetcapture_c
> ===================================================================
> RCS file: patches/patch-src_packetcapture_c
> diff -N patches/patch-src_packetcapture_c
> --- patches/patch-src_packetcapture_c 24 Apr 2017 18:16:03 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,21 +0,0 @@
> -$OpenBSD: patch-src_packetcapture_c,v 1.2 2017/04/24 18:16:03 sthen Exp $
> ---- src/packetcapture.c.orig Sun May 12 16:16:43 2013
> -+++ src/packetcapture.c Mon Apr 24 19:15:06 2017
> -@@ -103,7 +103,7 @@ void packetcapture_close(void)
> - pcap_close(pc);
> - }
> -
> --inline char* get_default_interface()
> -+char* get_default_interface()
> - {
> - char ebuf[PCAP_ERRBUF_SIZE];
> - char *interface;
> -@@ -120,7 +120,7 @@ inline char* get_default_interface()
> - return interface;
> - }
> -
> --inline void packetcapture_dispatch(void)
> -+void packetcapture_dispatch(void)
> - {
> - pcap_dispatch(pc, -1, process_packet, NULL);
> - }
> Index: patches/patch-src_packetcapture_h
> ===================================================================
> RCS file: patches/patch-src_packetcapture_h
> diff -N patches/patch-src_packetcapture_h
> --- patches/patch-src_packetcapture_h 24 Apr 2017 18:16:03 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,14 +0,0 @@
> -$OpenBSD: patch-src_packetcapture_h,v 1.2 2017/04/24 18:16:03 sthen Exp $
> ---- src/packetcapture.h.orig Sun May 12 16:16:43 2013
> -+++ src/packetcapture.h Mon Apr 24 19:15:13 2017
> -@@ -23,8 +23,8 @@ void packetcapture_open_live(char* interface, char* fi
> - void packetcapture_open_offline(char* dumpfile);
> - void packetcapture_close(void);
> -
> --inline void packetcapture_dispatch(void);
> -+void packetcapture_dispatch(void);
> -
> --inline char* get_default_interface();
> -+char* get_default_interface();
> -
> - #endif /* __PACKETCAPTURE_H__ */
> Index: patches/patch-src_pid_c
> ===================================================================
> RCS file: patches/patch-src_pid_c
> diff -N patches/patch-src_pid_c
> --- /dev/null 1 Jan 1970 00:00:00 -0000
> +++ patches/patch-src_pid_c 10 Oct 2019 09:12:44 -0000
> @@ -0,0 +1,16 @@
> +$OpenBSD$
> +
> +Include the right headers
> +
> +Index: src/pid.c
> +--- src/pid.c.orig
> ++++ src/pid.c
> +@@ -14,7 +14,7 @@
> +
> + #include "compat.h"
> +
> +-#ifdef __FreeBSD__
> ++#if defined(__FreeBSD__) || defined(__OpenBSD__)
> + #include <sys/stat.h>
> + #endif
> + #include <fcntl.h>
> Index: patches/patch-src_tmpdir_c
> ===================================================================
> RCS file: patches/patch-src_tmpdir_c
> diff -N patches/patch-src_tmpdir_c
> --- patches/patch-src_tmpdir_c 24 Apr 2017 18:16:03 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,12 +0,0 @@
> -$OpenBSD: patch-src_tmpdir_c,v 1.2 2017/04/24 18:16:03 sthen Exp $
> ---- src/tmpdir.c.orig Sun May 12 16:16:43 2013
> -+++ src/tmpdir.c Mon Apr 24 19:14:56 2017
> -@@ -72,7 +72,7 @@ void set_tmpdir(const char *dir, tmpdir_type_t type, i
> - log_msg(LOG_INFO, "using temporary file directory %s", tmpdir.path);
> - }
> -
> --inline const char* get_tmpdir(void)
> -+const char* get_tmpdir(void)
> - {
> - assert (tmpdir.path != NULL);
> -
> Index: patches/patch-src_tmpdir_h
> ===================================================================
> RCS file: patches/patch-src_tmpdir_h
> diff -N patches/patch-src_tmpdir_h
> --- patches/patch-src_tmpdir_h 24 Apr 2017 18:16:03 -0000 1.2
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,12 +0,0 @@
> -$OpenBSD: patch-src_tmpdir_h,v 1.2 2017/04/24 18:16:03 sthen Exp $
> ---- src/tmpdir.h.orig Sun May 12 16:16:43 2013
> -+++ src/tmpdir.h Mon Apr 24 19:15:00 2017
> -@@ -20,7 +20,7 @@
> - typedef enum { TMPDIR_APP_OWNED = 0, TMPDIR_USER_OWNED = 1 } tmpdir_type_t;
> -
> - void set_tmpdir(const char *dir, tmpdir_type_t type, int max_files);
> --inline const char* get_tmpdir(void);
> -+const char* get_tmpdir(void);
> - void clean_tmpdir(int preserve_files);
> -
> - const char* make_tmpdir(void);
> Index: pkg/PLIST
> ===================================================================
> RCS file: /cvs/ports/x11/driftnet/pkg/PLIST,v
> retrieving revision 1.3
> diff -u -p -r1.3 PLIST
> --- pkg/PLIST 24 Jun 2013 16:48:43 -0000 1.3
> +++ pkg/PLIST 10 Oct 2019 09:16:55 -0000
> @@ -2,5 +2,5 @@
> @bin bin/driftnet
> @man man/man1/driftnet.1
> share/doc/driftnet/
> -share/doc/driftnet/README
> +share/doc/driftnet/README.md
> share/doc/driftnet/TODO
>