diff options
author | Pete Fritchman <petef@FreeBSD.org> | 2002-06-09 23:51:16 +0000 |
---|---|---|
committer | Pete Fritchman <petef@FreeBSD.org> | 2002-06-09 23:51:16 +0000 |
commit | 5a72e169c09722d11679308296226f79c80c9c91 (patch) | |
tree | 47bcb24f7a5d8aa32b2affea6780b3523b137006 /net | |
parent | Update to 2.0.12. (diff) |
Add driftnet 0.1.4, a Tool to grab images out of (your) TCP
connections.
PR: 35438
Submitted by: Simon 'corecode' Schubert <corecode@corecode.ath.cx>
Diffstat (limited to 'net')
-rw-r--r-- | net/Makefile | 1 | ||||
-rw-r--r-- | net/driftnet/Makefile | 23 | ||||
-rw-r--r-- | net/driftnet/distinfo | 1 | ||||
-rw-r--r-- | net/driftnet/files/Makefile | 23 | ||||
-rw-r--r-- | net/driftnet/files/patch-driftnet.c | 155 | ||||
-rw-r--r-- | net/driftnet/files/patch-img.h | 13 | ||||
-rw-r--r-- | net/driftnet/pkg-comment | 1 | ||||
-rw-r--r-- | net/driftnet/pkg-descr | 14 | ||||
-rw-r--r-- | net/driftnet/pkg-plist | 1 |
9 files changed, 232 insertions, 0 deletions
diff --git a/net/Makefile b/net/Makefile index a40c6e21586e..60dffc01483e 100644 --- a/net/Makefile +++ b/net/Makefile @@ -96,6 +96,7 @@ SUBDIR += dnswalk SUBDIR += doc SUBDIR += domtools + SUBDIR += driftnet SUBDIR += easysoap SUBDIR += echoping SUBDIR += edonkey-core diff --git a/net/driftnet/Makefile b/net/driftnet/Makefile new file mode 100644 index 000000000000..3c313ab668da --- /dev/null +++ b/net/driftnet/Makefile @@ -0,0 +1,23 @@ +# New ports collection makefile for: driftnet +# Date created: 28 February 2002 +# Whom: Simon 'corecode' Schubert <corecode@corecode.ath.cx> +# +# $FreeBSD$ +# + +PORTNAME= driftnet +PORTVERSION= 0.1.4 +CATEGORIES= net +MASTER_SITES= http://www.ex-parrot.com/~chris/driftnet/ \ + http://www.vanheusden.com/mirrors/ + +MAINTAINER= corecode@corecode.ath.cx + +LIB_DEPENDS= ungif.5:${PORTSDIR}/graphics/libungif \ + jpeg.9:${PORTSDIR}/graphics/jpeg + +USE_GTK= yes +USE_X_PREFIX= yes +MAKEFILE= ${FILESDIR}/Makefile + +.include <bsd.port.mk> diff --git a/net/driftnet/distinfo b/net/driftnet/distinfo new file mode 100644 index 000000000000..91fc1231ccc7 --- /dev/null +++ b/net/driftnet/distinfo @@ -0,0 +1 @@ +MD5 (driftnet-0.1.4.tar.gz) = d7bcc13ee9237287104b55b67fd10a19 diff --git a/net/driftnet/files/Makefile b/net/driftnet/files/Makefile new file mode 100644 index 000000000000..728c587101c2 --- /dev/null +++ b/net/driftnet/files/Makefile @@ -0,0 +1,23 @@ +# $corecode: ports/driftnet/files/Makefile,v 1.1 2002/03/01 02:32:10 corecode Exp $ +# $FreeBSD$ + +VERSION?= 0.1.4 + +PROG= driftnet +SRCS= gif.c img.c jpeg.c png.c driftnet.c image.c display.c +CFLAGS+= -I${LOCALBASE}/include -DDRIFTNET_VERSION='"${VERSION}"' ${GTK_CFLAGS} +LDFLAGS+= ${GTK_LDFLAGS} -lpcap -ljpeg -lungif + +NOMAN= yes + +.if defined(PREFIX) +DESTDIR= ${PREFIX}/bin +.else +DESTDIR?= /usr/X11R6/bin +.endif + +GTK_CONFIG?= gtk12-config +GTK_CFLAGS!= ${GTK_CONFIG} --cflags +GTK_LDFLAGS!= ${GTK_CONFIG} --libs + +.include <bsd.prog.mk> diff --git a/net/driftnet/files/patch-driftnet.c b/net/driftnet/files/patch-driftnet.c new file mode 100644 index 000000000000..cab6c624b0a4 --- /dev/null +++ b/net/driftnet/files/patch-driftnet.c @@ -0,0 +1,155 @@ +$FreeBSD$ + +--- driftnet.c.orig Tue Sep 11 11:34:56 2001 ++++ driftnet.c Fri Mar 1 02:05:56 2002 +@@ -14,7 +14,9 @@ + #include <assert.h> + #include <errno.h> + #include <pcap.h> +-#include <linux/if_ether.h> ++#include <sys/types.h> ++#include <netinet/in_systm.h> ++#include <netinet/in.h> + #include <netinet/ip.h> + #include <netinet/tcp.h> + #include <stdlib.h> +@@ -261,8 +263,8 @@ + "Synopsis: driftnet -h | [-i interface] [-p] [-v] [filter code]\n" + "\n" + " -h Display this help message.\n" +-" -i interface Select the interface on which to listen (default: all\n" +-" interfaces).\n" ++" -i interface Select the interface on which to listen (default: first\n" ++" available interface).\n" + " -p Do not put the listening interface into promiscuous mode.\n" + " -v Verbose operation.\n" + "\n" +@@ -293,7 +295,7 @@ + void setup_signals(void) { + int *p; + /* Signals to ignore. */ +- int ignore_signals[] = {SIGPIPE, 0}; ++ int ignore_signals[] = {SIGPIPE, SIGCONT, SIGHUP, 0}; + /* Signals which mean we should quit, killing the display child if + * applicable. */ + int terminate_signals[] = {SIGTERM, SIGINT, SIGSEGV, SIGBUS, SIGCHLD, 0}; +@@ -393,6 +395,15 @@ + } + } + ++ if (!interface) { ++ interface = pcap_lookupdev(ebuf); ++ ++ if (!interface) { ++ fprintf(stderr, PROGNAME": pcap_lookupdev: %s\n", ebuf); ++ return -1; ++ } ++ } ++ + + if (verbose) + fprintf(stderr, PROGNAME": listening on %s%s\n", interface ? interface : "all interfaces", promisc ? " in promiscuous mode" : ""); +@@ -468,7 +479,7 @@ + fprintf(stderr, PROGNAME": link-level header length is %d bytes\n", pkt_offset); + + while (!foad) { +- struct iphdr ip; ++ struct ip ip; + struct tcphdr tcp; + struct in_addr s, d; + int off, len; +@@ -485,32 +496,32 @@ + fprintf(stderr, "packet len = %d captured = %d!\n", hdr.len, hdr.caplen); + */ + memcpy(&ip, pkt + pkt_offset, sizeof(ip)); +- memcpy(&s, &ip.saddr, sizeof(ip.saddr)); +- memcpy(&d, &ip.daddr, sizeof(ip.daddr)); ++ memcpy(&s, &ip.ip_src, sizeof(ip.ip_src)); ++ memcpy(&d, &ip.ip_dst, sizeof(ip.ip_dst)); + +- memcpy(&tcp, pkt + pkt_offset + (ip.ihl << 2), sizeof(tcp)); +- off = pkt_offset + (ip.ihl << 2) + (tcp.doff << 2); ++ memcpy(&tcp, pkt + pkt_offset + (ip.ip_hl << 2), sizeof(tcp)); ++ off = pkt_offset + (ip.ip_hl << 2) + (tcp.th_off << 2); + len = hdr.caplen - off; + + /* + if (verbose) +- fprintf(stderr, PROGNAME": captured packet: %s:%d -> %s:%d\n", inet_ntoa(s), ntohs(tcp.source), inet_ntoa(d), ntohs(tcp.dest)); ++ fprintf(stderr, PROGNAME": captured packet: %s:%d -> %s:%d\n", inet_ntoa(s), ntohs(tcp.th_sport), inet_ntoa(d), ntohs(tcp.th_dport)); + */ + + /* XXX fragmented packets and other nasties. */ + + /* try to find the connection slot associated with this. */ +- C = find_connection(&s, &d, ntohs(tcp.source), ntohs(tcp.dest)); ++ C = find_connection(&s, &d, ntohs(tcp.th_sport), ntohs(tcp.th_dport)); + + /* no connection at all, so we need to allocate one. */ + if (!C) { + if (verbose) +- fprintf(stderr, PROGNAME": new connection: %s\n", connection_string(s, ntohs(tcp.source), d, ntohs(tcp.dest))); ++ fprintf(stderr, PROGNAME": new connection: %s\n", connection_string(s, ntohs(tcp.th_sport), d, ntohs(tcp.th_dport))); + C = alloc_connection(); +- *C = connection_new(&s, &d, ntohs(tcp.source), ntohs(tcp.dest)); ++ *C = connection_new(&s, &d, ntohs(tcp.th_sport), ntohs(tcp.th_dport)); + /* This might or might not be an entirely new connection (SYN flag + * set). Either way we need a sequence number to start at. */ +- (*C)->isn = ntohl(tcp.seq); ++ (*C)->isn = ntohl(tcp.th_seq); + } + + /* Now we need to process this segment. */ +@@ -526,16 +537,16 @@ + c->isn = htonl(tcp.seq); + #endif + +- if (tcp.rst) { ++ if (tcp.th_flags & TH_RST) { + /* Looks like this connection is bogus, and so might be a + * connection going the other way. */ + if (verbose) +- fprintf(stderr, PROGNAME": connection reset: %s\n", connection_string(s, ntohs(tcp.source), d, ntohs(tcp.dest))); ++ fprintf(stderr, PROGNAME": connection reset: %s\n", connection_string(s, ntohs(tcp.th_sport), d, ntohs(tcp.th_dport))); + + connection_delete(c); + *C = NULL; + +- if ((C = find_connection(&d, &s, ntohs(tcp.dest), ntohs(tcp.source)))) { ++ if ((C = find_connection(&d, &s, ntohs(tcp.th_dport), ntohs(tcp.th_sport)))) { + connection_delete(*C); + *C = NULL; + } +@@ -547,7 +558,7 @@ + /* We have some data in the packet. If this data occurred after + * the first data we collected for this connection, then save it + * so that we can look for images. Otherwise, discard it. */ +- unsigned int offset = ntohl(tcp.seq); ++ unsigned int offset = ntohl(tcp.th_seq); + + /* Modulo 2**32 arithmetic; offset = seq - isn + delta. */ + if (offset < (c->isn + delta)) +@@ -558,19 +569,19 @@ + if (offset > c->len + 262144) { + /* Out-of-order packet. */ + if (verbose) +- fprintf(stderr, PROGNAME": out of order packet: %s\n", connection_string(s, ntohs(tcp.source), d, ntohs(tcp.dest))); ++ fprintf(stderr, PROGNAME": out of order packet: %s\n", connection_string(s, ntohs(tcp.th_sport), d, ntohs(tcp.th_dport))); + } else { + /* if (verbose) +- fprintf(stderr, PROGNAME": captured %d bytes: %s:%d -> %s:%d\n", (int)len, inet_ntoa(s), ntohs(tcp.source), inet_ntoa(d), ntohs(tcp.dest));*/ ++ fprintf(stderr, PROGNAME": captured %d bytes: %s:%d -> %s:%d\n", (int)len, inet_ntoa(s), ntohs(tcp.th_sport), inet_ntoa(d), ntohs(tcp.th_dport));*/ + connection_push(c, pkt + off, offset, len); + connection_harvest_images(c); + } + } + +- if (tcp.fin) { ++ if (tcp.th_flags & TH_FIN) { + /* Connection closing. */ + if (verbose) +- fprintf(stderr, PROGNAME": connection closing: %s, %d bytes transferred\n", connection_string(s, ntohs(tcp.source), d, ntohs(tcp.dest)), c->len); ++ fprintf(stderr, PROGNAME": connection closing: %s, %d bytes transferred\n", connection_string(s, ntohs(tcp.th_sport), d, ntohs(tcp.th_dport)), c->len); + connection_harvest_images(c); + connection_delete(c); + *C = NULL; diff --git a/net/driftnet/files/patch-img.h b/net/driftnet/files/patch-img.h new file mode 100644 index 000000000000..9d05f872be69 --- /dev/null +++ b/net/driftnet/files/patch-img.h @@ -0,0 +1,13 @@ +$FreeBSD$ + +--- img.h.orig Tue Sep 11 11:34:56 2001 ++++ img.h Fri Mar 1 00:01:34 2002 +@@ -12,7 +12,7 @@ + #ifndef __IMG_H_ /* include guard */ + #define __IMG_H_ + +-#include <stdint.h> ++#include <sys/types.h> + #include <stdio.h> + + typedef uint8_t chan; diff --git a/net/driftnet/pkg-comment b/net/driftnet/pkg-comment new file mode 100644 index 000000000000..f3fcf61a57e4 --- /dev/null +++ b/net/driftnet/pkg-comment @@ -0,0 +1 @@ +A Tool to grab images out of (your) TCP connections diff --git a/net/driftnet/pkg-descr b/net/driftnet/pkg-descr new file mode 100644 index 000000000000..2b2e853684ca --- /dev/null +++ b/net/driftnet/pkg-descr @@ -0,0 +1,14 @@ +EtherPEG was a program that sniffed for JPEGs passing by on the AirPort +networks at MacHack, and showed them on the huge screen to shame people +into a) turning the 802.11 encryption on, or b) reducing amount of pr0n +they download at weirdo Mac conventions. DRIFTNET can do the same for +*your* office, and make an attractive desktop accessory to boot. The +program promiscuously sniffs and decodes any JPEG downloaded by anyone +on your LAN, displaying it in an attractive, ever changing mosaic of +fluffy kittens, oversized navigation buttons, and blurred images of Big +Brother Elizabeth fiddling. It's UNIX only. Your sysadmin is undoubtedly +running it already. So stop that. Now. + +WWW: http://www.ex-parrot.com/~chris/driftnet/ + +- Simon 'corecode' Schubert diff --git a/net/driftnet/pkg-plist b/net/driftnet/pkg-plist new file mode 100644 index 000000000000..b1525af7a32a --- /dev/null +++ b/net/driftnet/pkg-plist @@ -0,0 +1 @@ +bin/driftnet |