aboutsummaryrefslogtreecommitdiffstats
path: root/testing
diff options
context:
space:
mode:
Diffstat (limited to 'testing')
-rw-r--r--testing/dsniff/0001-arpspoof-add-r-switch-to-poison-both-directions.patch174
-rw-r--r--testing/dsniff/0001-rewrite-and-modernize-POP-decoder.patch135
-rw-r--r--testing/dsniff/0002-arpspoof-allow-use-of-of-multiple-targets.patch194
-rw-r--r--testing/dsniff/0003-arpspoof-allow-selection-of-source-hw-address.patch228
-rw-r--r--testing/dsniff/0004-arpspoof-mac-include.patch12
-rw-r--r--testing/dsniff/01_time.h.patch23
-rw-r--r--testing/dsniff/02_mailsnarf_corrupt.patch13
-rw-r--r--testing/dsniff/03_pcap_read_dump.patch531
-rw-r--r--testing/dsniff/04_multiple_intf.patch52
-rw-r--r--testing/dsniff/05_amd64_fix.patch217
-rw-r--r--testing/dsniff/06_urlsnarf_zeropad.patch13
-rw-r--r--testing/dsniff/07_libnet_1.1.patch903
-rw-r--r--testing/dsniff/08_checksum.patch25
-rw-r--r--testing/dsniff/08_openssl-0.9.8.patch12
-rw-r--r--testing/dsniff/09_sshcrypto.patch14
-rw-r--r--testing/dsniff/09_sysconf_clocks.patch20
-rw-r--r--testing/dsniff/10_urlsnarf_escape.patch85
-rw-r--r--testing/dsniff/11_string_header.patch163
-rw-r--r--testing/dsniff/12_arpa_inet_header.patch62
-rw-r--r--testing/dsniff/13_pop_with_version.patch27
-rw-r--r--testing/dsniff/14_obsolete_time.patch33
-rw-r--r--testing/dsniff/15_checksum_libnids.patch94
-rw-r--r--testing/dsniff/16_TDS_decoder.patch16
-rw-r--r--testing/dsniff/20_debian_dirs.patch59
-rw-r--r--testing/dsniff/21_msgsnarf_segfault.patch12
-rw-r--r--testing/dsniff/22_handlepp.patch14
-rw-r--r--testing/dsniff/23_urlsnarf_timestamp.patch78
-rw-r--r--testing/dsniff/APKBUILD166
-rw-r--r--testing/dsniff/dsniff-rpc.patch92
-rw-r--r--testing/dsniff/dsniff-xcompile.patch56
30 files changed, 3523 insertions, 0 deletions
diff --git a/testing/dsniff/0001-arpspoof-add-r-switch-to-poison-both-directions.patch b/testing/dsniff/0001-arpspoof-add-r-switch-to-poison-both-directions.patch
new file mode 100644
index 0000000000..4576531ad4
--- /dev/null
+++ b/testing/dsniff/0001-arpspoof-add-r-switch-to-poison-both-directions.patch
@@ -0,0 +1,174 @@
+>From 8fbf0ac15e5fe2df427e3e028f9aa8d96788986a Mon Sep 17 00:00:00 2001
+From: Stefan Tomanek <stefan@pico.ruhr.de>
+Date: Sun, 6 Nov 2011 22:44:54 +0100
+Subject: [PATCH 1/3] arpspoof: add -r switch to poison both directions
+
+
+Signed-off-by: Stefan Tomanek <stefan@pico.ruhr.de>
+---
+ arpspoof.8 | 5 ++++-
+ arpspoof.c | 59 +++++++++++++++++++++++++++++++++++++++++++++++------------
+ 2 files changed, 51 insertions(+), 13 deletions(-)
+
+diff --git a/arpspoof.8 b/arpspoof.8
+index a05b5d3..544e06c 100644
+--- a/arpspoof.8
++++ b/arpspoof.8
+@@ -9,7 +9,7 @@ intercept packets on a switched LAN
+ .na
+ .nf
+ .fi
+-\fBarpspoof\fR [\fB-i \fIinterface\fR] [\fB-t \fItarget\fR] \fIhost\fR
++\fBarpspoof\fR [\fB\-i \fIinterface\fR] [\fB\-t \fItarget\fR] [\fB\-r\fR] \fIhost\fR
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -26,6 +26,9 @@ Specify the interface to use.
+ .IP "\fB-t \fItarget\fR"
+ Specify a particular host to ARP poison (if not specified, all hosts
+ on the LAN).
++.IP "\fB\-r\fR"
++Poison both hosts (host and target) to capture traffic in both directions.
++(only valid in conjuntion with \-t)
+ .IP \fIhost\fR
+ Specify the host you wish to intercept packets for (usually the local
+ gateway).
+diff --git a/arpspoof.c b/arpspoof.c
+index 7cdbbf8..f51b699 100644
+--- a/arpspoof.c
++++ b/arpspoof.c
+@@ -7,6 +7,8 @@
+ * Copyright (c) 1999 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: arpspoof.c,v 1.5 2001/03/15 08:32:58 dugsong Exp $
++ *
++ * Improved 2011 by Stefan Tomanek <stefa@pico.ruhr.de>
+ */
+
+ #include "config.h"
+@@ -31,12 +33,13 @@ static libnet_t *l;
+ static struct ether_addr spoof_mac, target_mac;
+ static in_addr_t spoof_ip, target_ip;
+ static char *intf;
++static int poison_reverse;
+
+ static void
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: arpspoof [-i interface] [-t target] host\n");
++ "Usage: arpspoof [-i interface] [-t target] [-r] host\n");
+ exit(1);
+ }
+
+@@ -133,18 +136,30 @@ arp_find(in_addr_t ip, struct ether_addr *mac)
+ static void
+ cleanup(int sig)
+ {
++ int fw = arp_find(spoof_ip, &spoof_mac);
++ int bw = poison_reverse && target_ip && arp_find(target_ip, &target_mac);
+ int i;
+-
+- if (arp_find(spoof_ip, &spoof_mac)) {
+- for (i = 0; i < 3; i++) {
+- /* XXX - on BSD, requires ETHERSPOOF kernel. */
++
++ fprintf(stderr, "Cleaning up and re-arping targets...\n");
++ for (i = 0; i < 5; i++) {
++ /* XXX - on BSD, requires ETHERSPOOF kernel. */
++ if (fw) {
+ arp_send(l, ARPOP_REPLY,
+ (u_int8_t *)&spoof_mac, spoof_ip,
+ (target_ip ? (u_int8_t *)&target_mac : NULL),
+ target_ip);
++ /* we have to wait a moment before sending the next packet */
++ sleep(1);
++ }
++ if (bw) {
++ arp_send(l, ARPOP_REPLY,
++ (u_int8_t *)&target_mac, target_ip,
++ (u_int8_t *)&spoof_mac,
++ spoof_ip);
+ sleep(1);
+ }
+ }
++
+ exit(0);
+ }
+
+@@ -156,11 +171,12 @@ main(int argc, char *argv[])
+ char pcap_ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ int c;
+-
++
+ intf = NULL;
+ spoof_ip = target_ip = 0;
+-
+- while ((c = getopt(argc, argv, "i:t:h?V")) != -1) {
++ poison_reverse = 0;
++
++ while ((c = getopt(argc, argv, "ri:t:h?V")) != -1) {
+ switch (c) {
+ case 'i':
+ intf = optarg;
+@@ -169,6 +185,9 @@ main(int argc, char *argv[])
+ if ((target_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
+ usage();
+ break;
++ case 'r':
++ poison_reverse = 1;
++ break;
+ default:
+ usage();
+ }
+@@ -178,7 +197,12 @@ main(int argc, char *argv[])
+
+ if (argc != 1)
+ usage();
+-
++
++ if (poison_reverse && !target_ip) {
++ errx(1, "Spoofing the reverse path (-r) is only available when specifying a target (-t).");
++ usage();
++ }
++
+ if ((spoof_ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
+ usage();
+
+@@ -191,18 +215,29 @@ main(int argc, char *argv[])
+ if (target_ip != 0 && !arp_find(target_ip, &target_mac))
+ errx(1, "couldn't arp for host %s",
+ libnet_addr2name4(target_ip, LIBNET_DONT_RESOLVE));
+-
++
++ if (poison_reverse) {
++ if (!arp_find(spoof_ip, &spoof_mac)) {
++ errx(1, "couldn't arp for spoof host %s",
++ libnet_addr2name4(spoof_ip, LIBNET_DONT_RESOLVE));
++ }
++ }
++
+ signal(SIGHUP, cleanup);
+ signal(SIGINT, cleanup);
+ signal(SIGTERM, cleanup);
+-
++
+ for (;;) {
+ arp_send(l, ARPOP_REPLY, NULL, spoof_ip,
+ (target_ip ? (u_int8_t *)&target_mac : NULL),
+ target_ip);
++ if (poison_reverse) {
++ arp_send(l, ARPOP_REPLY, NULL, target_ip, (uint8_t *)&spoof_mac, spoof_ip);
++ }
++
+ sleep(2);
+ }
+ /* NOTREACHED */
+-
++
+ exit(0);
+ }
+--
+1.7.5.4
+
diff --git a/testing/dsniff/0001-rewrite-and-modernize-POP-decoder.patch b/testing/dsniff/0001-rewrite-and-modernize-POP-decoder.patch
new file mode 100644
index 0000000000..71d6707448
--- /dev/null
+++ b/testing/dsniff/0001-rewrite-and-modernize-POP-decoder.patch
@@ -0,0 +1,135 @@
+>From b05e27ba9b0ba9ef00ad2183933652e08d8c89af Mon Sep 17 00:00:00 2001
+From: Stefan Tomanek <stefan@pico.ruhr.de>
+Date: Sat, 29 Oct 2011 20:48:55 +0200
+Subject: [PATCH] rewrite and modernize POP decoder
+
+
+Signed-off-by: Stefan Tomanek <stefan@pico.ruhr.de>
+---
+ decode_pop.c | 96 ++++++++++++++++++++++++++++++++++++++++++++++-----------
+ 1 files changed, 77 insertions(+), 19 deletions(-)
+
+diff --git a/decode_pop.c b/decode_pop.c
+index 04044f5..767da41 100644
+--- a/decode_pop.c
++++ b/decode_pop.c
+@@ -6,6 +6,8 @@
+ * Copyright (c) 2000 Dug Song <dugsong@monkey.org>
+ *
+ * $Id: decode_pop.c,v 1.4 2001/03/15 08:33:02 dugsong Exp $
++ *
++ * Rewritten by Stefan Tomanek 2011 <stefan@pico.ruhr.de>
+ */
+
+ #include "config.h"
+@@ -45,32 +47,88 @@ int
+ decode_pop(u_char *buf, int len, u_char *obuf, int olen)
+ {
+ char *p;
++ char *s;
++ int n;
+ int i, j;
++ char *user;
++ char *password;
++ enum {
++ NONE,
++ AUTHPLAIN,
++ AUTHLOGIN,
++ USERPASS
++ } mode = NONE;
++
+
+ obuf[0] = '\0';
+
+ for (p = strtok(buf, "\r\n"); p != NULL; p = strtok(NULL, "\r\n")) {
+- if (strncasecmp(p, "AUTH PLAIN", 10) == 0 ||
+- strncasecmp(p, "AUTH LOGIN", 10) == 0) {
+- strlcat(obuf, p, olen);
+- strlcat(obuf, "\n", olen);
+-
+- /* Decode SASL auth. */
+- for (i = 0; i < 2 && (p = strtok(NULL, "\r\n")); i++) {
+- strlcat(obuf, p, olen);
+- j = base64_pton(p, p, strlen(p));
+- p[j] = '\0';
+- strlcat(obuf, " [", olen);
+- strlcat(obuf, p, olen);
+- strlcat(obuf, "]\n", olen);
++ if (mode == NONE) {
++ user = NULL;
++ password = NULL;
++ if (strncasecmp(p, "AUTH PLAIN", 10) == 0) {
++ mode = AUTHPLAIN;
++ continue;
++ }
++ if (strncasecmp(p, "AUTH LOGIN", 10) == 0) {
++ mode = AUTHLOGIN;
++ continue;
++ }
++ if (strncasecmp(p, "USER ", 5) == 0) {
++ mode = USERPASS;
++ /* the traditional login cuts right to the case,
++ * so no continue here
++ */
+ }
+ }
+- /* Save regular POP2, POP3 auth info. */
+- else if (strncasecmp(p, "USER ", 5) == 0 ||
+- strncasecmp(p, "PASS ", 5) == 0 ||
+- strncasecmp(p, "HELO ", 5) == 0) {
+- strlcat(obuf, p, olen);
+- strlcat(obuf, "\n", olen);
++ printf("(%d) %s\n", mode, p);
++ if (mode == USERPASS) {
++ if (strncasecmp(p, "USER ", 5) == 0) {
++ user = &p[5];
++ } else if (strncasecmp(p, "PASS ", 5) == 0) {
++ password = &p[5];
++ }
++ }
++
++ if (mode == AUTHPLAIN) {
++ j = base64_pton(p, p, strlen(p));
++ p[j] = '\0';
++ n = 0;
++ s = p;
++ /* p consists of three parts, divided by \0 */
++ while (s <= &p[j] && n<=3) {
++ if (n == 0) {
++ /* we do not process this portion yet */
++ } else if (n == 1) {
++ user = s;
++ } else if (n == 2) {
++ password = s;
++ }
++ n++;
++ while (*s) s++;
++ s++;
++ }
++ }
++
++ if (mode == AUTHLOGIN) {
++ j = base64_pton(p, p, strlen(p));
++ p[j] = '\0';
++ if (! user) {
++ user = p;
++ } else {
++ password = p;
++ /* got everything we need :-) */
++ }
++ }
++
++ if (user && password) {
++ strlcat(obuf, "\nusername [", olen);
++ strlcat(obuf, user, olen);
++ strlcat(obuf, "] password [", olen);
++ strlcat(obuf, password, olen);
++ strlcat(obuf, "]\n", olen);
++
++ mode = NONE;
+ }
+ }
+ return (strlen(obuf));
+--
+1.7.5.4
+
diff --git a/testing/dsniff/0002-arpspoof-allow-use-of-of-multiple-targets.patch b/testing/dsniff/0002-arpspoof-allow-use-of-of-multiple-targets.patch
new file mode 100644
index 0000000000..0da635daf0
--- /dev/null
+++ b/testing/dsniff/0002-arpspoof-allow-use-of-of-multiple-targets.patch
@@ -0,0 +1,194 @@
+>From 25c761ebb1a8001d05da8b3dba36e96ac07ad586 Mon Sep 17 00:00:00 2001
+From: Stefan Tomanek <stefan@pico.ruhr.de>
+Date: Mon, 7 Nov 2011 17:40:50 +0100
+Subject: [PATCH 2/3] arpspoof: allow use of of multiple targets
+
+
+Signed-off-by: Stefan Tomanek <stefan@pico.ruhr.de>
+---
+ arpspoof.8 | 2 +-
+ arpspoof.c | 102 ++++++++++++++++++++++++++++++++++++++++--------------------
+ 2 files changed, 69 insertions(+), 35 deletions(-)
+
+--- a/arpspoof.8 2012-03-14 13:24:27.000000000 -0600
++++ b/arpspoof.8 2012-03-14 13:25:55.782078436 -0600
+@@ -25,7 +25,7 @@
+ Specify the interface to use.
+ .IP "\fB-t \fItarget\fR"
+ Specify a particular host to ARP poison (if not specified, all hosts
+-on the LAN).
++on the LAN). Repeat to specify multiple hosts.
+ .IP "\fB\-r\fR"
+ Poison both hosts (host and target) to capture traffic in both directions.
+ (only valid in conjuntion with \-t)
+--- a/arpspoof.c 2012-03-14 13:24:27.626081655 -0600
++++ b/arpspoof.c 2012-03-14 13:24:27.646081654 -0600
+@@ -29,9 +29,14 @@
+
+ extern char *ether_ntoa(struct ether_addr *);
+
++struct host {
++ in_addr_t ip;
++ struct ether_addr mac;
++};
++
+ static libnet_t *l;
+-static struct ether_addr spoof_mac, target_mac;
+-static in_addr_t spoof_ip, target_ip;
++static struct host spoof = {0};
++static struct host *targets;
+ static char *intf;
+ static int poison_reverse;
+
+@@ -133,30 +138,46 @@
+ return (0);
+ }
+
++static int arp_find_all() {
++ struct host *target = targets;
++ while(target->ip) {
++ if (arp_find(target->ip, &target->mac)) {
++ return 1;
++ }
++ target++;
++ }
++
++ return 0;
++}
++
+ static void
+ cleanup(int sig)
+ {
+- int fw = arp_find(spoof_ip, &spoof_mac);
+- int bw = poison_reverse && target_ip && arp_find(target_ip, &target_mac);
++ int fw = arp_find(spoof.ip, &spoof.mac);
++ int bw = poison_reverse && targets[0].ip && arp_find_all();
+ int i;
+
+ fprintf(stderr, "Cleaning up and re-arping targets...\n");
+ for (i = 0; i < 5; i++) {
+- /* XXX - on BSD, requires ETHERSPOOF kernel. */
+- if (fw) {
+- arp_send(l, ARPOP_REPLY,
+- (u_int8_t *)&spoof_mac, spoof_ip,
+- (target_ip ? (u_int8_t *)&target_mac : NULL),
+- target_ip);
+- /* we have to wait a moment before sending the next packet */
+- sleep(1);
+- }
+- if (bw) {
+- arp_send(l, ARPOP_REPLY,
+- (u_int8_t *)&target_mac, target_ip,
+- (u_int8_t *)&spoof_mac,
+- spoof_ip);
+- sleep(1);
++ struct host *target = targets;
++ while(target->ip) {
++ /* XXX - on BSD, requires ETHERSPOOF kernel. */
++ if (fw) {
++ arp_send(l, ARPOP_REPLY,
++ (u_int8_t *)&spoof.mac, spoof.ip,
++ (target->ip ? (u_int8_t *)&target->mac : NULL),
++ target->ip);
++ /* we have to wait a moment before sending the next packet */
++ sleep(1);
++ }
++ if (bw) {
++ arp_send(l, ARPOP_REPLY,
++ (u_int8_t *)&target->mac, target->ip,
++ (u_int8_t *)&spoof.mac,
++ spoof.ip);
++ sleep(1);
++ }
++ target++;
+ }
+ }
+
+@@ -171,10 +192,15 @@
+ char pcap_ebuf[PCAP_ERRBUF_SIZE];
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ int c;
++ int n_targets;
+
++ spoof.ip = 0;
+ intf = NULL;
+- spoof_ip = target_ip = 0;
+ poison_reverse = 0;
++ n_targets = 0;
++
++ /* allocate enough memory for target list */
++ targets = calloc( argc+1, sizeof(struct host) );
+
+ while ((c = getopt(argc, argv, "ri:t:h?V")) != -1) {
+ switch (c) {
+@@ -182,7 +208,7 @@
+ intf = optarg;
+ break;
+ case 't':
+- if ((target_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
++ if ((targets[n_targets++].ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
+ usage();
+ break;
+ case 'r':
+@@ -198,12 +224,12 @@
+ if (argc != 1)
+ usage();
+
+- if (poison_reverse && !target_ip) {
++ if (poison_reverse && !n_targets) {
+ errx(1, "Spoofing the reverse path (-r) is only available when specifying a target (-t).");
+ usage();
+ }
+
+- if ((spoof_ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
++ if ((spoof.ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
+ usage();
+
+ if (intf == NULL && (intf = pcap_lookupdev(pcap_ebuf)) == NULL)
+@@ -211,15 +237,19 @@
+
+ if ((l = libnet_init(LIBNET_LINK, intf, libnet_ebuf)) == NULL)
+ errx(1, "%s", libnet_ebuf);
+-
+- if (target_ip != 0 && !arp_find(target_ip, &target_mac))
+- errx(1, "couldn't arp for host %s",
+- libnet_addr2name4(target_ip, LIBNET_DONT_RESOLVE));
++
++ struct host *target = targets;
++ while(target->ip) {
++ if (target->ip != 0 && !arp_find(target->ip, &target->mac))
++ errx(1, "couldn't arp for host %s",
++ libnet_addr2name4(target->ip, LIBNET_DONT_RESOLVE));
++ target++;
++ }
+
+ if (poison_reverse) {
+- if (!arp_find(spoof_ip, &spoof_mac)) {
++ if (!arp_find(spoof.ip, &spoof.mac)) {
+ errx(1, "couldn't arp for spoof host %s",
+- libnet_addr2name4(spoof_ip, LIBNET_DONT_RESOLVE));
++ libnet_addr2name4(spoof.ip, LIBNET_DONT_RESOLVE));
+ }
+ }
+
+@@ -228,11 +258,15 @@
+ signal(SIGTERM, cleanup);
+
+ for (;;) {
+- arp_send(l, ARPOP_REPLY, NULL, spoof_ip,
+- (target_ip ? (u_int8_t *)&target_mac : NULL),
+- target_ip);
+- if (poison_reverse) {
+- arp_send(l, ARPOP_REPLY, NULL, target_ip, (uint8_t *)&spoof_mac, spoof_ip);
++ struct host *target = targets;
++ while(target->ip) {
++ arp_send(l, ARPOP_REPLY, NULL, spoof.ip,
++ (target->ip ? (u_int8_t *)&target->mac : NULL),
++ target->ip);
++ if (poison_reverse) {
++ arp_send(l, ARPOP_REPLY, NULL, target->ip, (uint8_t *)&spoof.mac, spoof.ip);
++ }
++ target++;
+ }
+
+ sleep(2);
diff --git a/testing/dsniff/0003-arpspoof-allow-selection-of-source-hw-address.patch b/testing/dsniff/0003-arpspoof-allow-selection-of-source-hw-address.patch
new file mode 100644
index 0000000000..bb8be00d1e
--- /dev/null
+++ b/testing/dsniff/0003-arpspoof-allow-selection-of-source-hw-address.patch
@@ -0,0 +1,228 @@
+>From 21773ccf18a5fc49d35e510a8797b0a1e83858c4 Mon Sep 17 00:00:00 2001
+From: Stefan Tomanek <stefan@pico.ruhr.de>
+Date: Sun, 20 Nov 2011 21:32:53 +0100
+Subject: [PATCH 3/3] arpspoof: allow selection of source hw address
+
+In certain networks, sending with the wrong hardware source address can
+jeopardize the network connection of the host running arpspoof. This
+patch makes it possible to specify whether arpspoof should use the own
+hardware address or the one of the real host when resetting the arp
+table of the target systems; it is also possible to use both.
+
+Signed-off-by: Stefan Tomanek <stefan@pico.ruhr.de>
+---
+ arpspoof.8 | 9 +++++-
+ arpspoof.c | 90 ++++++++++++++++++++++++++++++++++++++++++-----------------
+ 2 files changed, 72 insertions(+), 27 deletions(-)
+
+--- a/arpspoof.8 2012-03-14 13:33:30.000000000 -0600
++++ b/arpspoof.8 2012-03-14 13:36:18.898055700 -0600
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBarpspoof\fR [\fB\-i \fIinterface\fR] [\fB\-t \fItarget\fR] [\fB\-r\fR] \fIhost\fR
++\fBarpspoof\fR [\fB\-i \fIinterface\fR] [\fB\-c \fIown|host|both\fR] [\fB\-t \fItarget\fR] [\fB\-r\fR] \fIhost\fR
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -23,6 +23,13 @@
+ .SH OPTIONS
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to use.
++.IP "\fB-c \fIown|host|both\fR"
++Specify which hardware address t use when restoring the arp configuration;
++while cleaning up, packets can be send with the own address as well as with
++the address of the host. Sending packets with a fake hw address can disrupt
++connectivity with certain switch/ap/bridge configurations, however it works
++more reliably than using the own address, which is the default way arpspoof
++cleans up afterwards.
+ .IP "\fB-t \fItarget\fR"
+ Specify a particular host to ARP poison (if not specified, all hosts
+ on the LAN). Repeat to specify multiple hosts.
+--- a/arpspoof.c 2012-03-14 13:33:30.000000000 -0600
++++ b/arpspoof.c 2012-03-14 13:34:11.134060364 -0600
+@@ -40,37 +40,36 @@
+ static char *intf;
+ static int poison_reverse;
+
++static uint8_t *my_ha = NULL;
++static uint8_t *brd_ha = "\xff\xff\xff\xff\xff\xff";
++
++static int cleanup_src_own = 1;
++static int cleanup_src_host = 0;
++
+ static void
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: arpspoof [-i interface] [-t target] [-r] host\n");
++ "Usage: arpspoof [-i interface] [-c own|host|both] [-t target] [-r] host\n");
+ exit(1);
+ }
+
+ static int
+-arp_send(libnet_t *l, int op, u_int8_t *sha,
+- in_addr_t spa, u_int8_t *tha, in_addr_t tpa)
++arp_send(libnet_t *l, int op,
++ u_int8_t *sha, in_addr_t spa,
++ u_int8_t *tha, in_addr_t tpa,
++ u_int8_t *me)
+ {
+ int retval;
+
+- if (sha == NULL &&
+- (sha = (u_int8_t *)libnet_get_hwaddr(l)) == NULL) {
+- return (-1);
+- }
+- if (spa == 0) {
+- if ((spa = libnet_get_ipaddr4(l)) == -1)
+- return (-1);
+- }
+- if (tha == NULL)
+- tha = "\xff\xff\xff\xff\xff\xff";
+-
++ if (!me) me = sha;
++
+ libnet_autobuild_arp(op, sha, (u_int8_t *)&spa,
+ tha, (u_int8_t *)&tpa, l);
+- libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, l, 0);
++ libnet_build_ethernet(tha, me, ETHERTYPE_ARP, NULL, 0, l, 0);
+
+ fprintf(stderr, "%s ",
+- ether_ntoa((struct ether_addr *)sha));
++ ether_ntoa((struct ether_addr *)me));
+
+ if (op == ARPOP_REQUEST) {
+ fprintf(stderr, "%s 0806 42: arp who-has %s tell %s\n",
+@@ -129,7 +128,7 @@
+ /* XXX - force the kernel to arp. feh. */
+ arp_force(ip);
+ #else
+- arp_send(l, ARPOP_REQUEST, NULL, 0, NULL, ip);
++ arp_send(l, ARPOP_REQUEST, NULL, 0, NULL, ip, NULL);
+ #endif
+ sleep(1);
+ }
+@@ -156,17 +155,23 @@
+ int fw = arp_find(spoof.ip, &spoof.mac);
+ int bw = poison_reverse && targets[0].ip && arp_find_all();
+ int i;
++ int rounds = (cleanup_src_own*5 + cleanup_src_host*5);
+
+ fprintf(stderr, "Cleaning up and re-arping targets...\n");
+- for (i = 0; i < 5; i++) {
++ for (i = 0; i < rounds; i++) {
+ struct host *target = targets;
+ while(target->ip) {
++ uint8_t *src_ha = NULL;
++ if (cleanup_src_own && (i%2 || !cleanup_src_host)) {
++ src_ha = my_ha;
++ }
+ /* XXX - on BSD, requires ETHERSPOOF kernel. */
+ if (fw) {
+ arp_send(l, ARPOP_REPLY,
+ (u_int8_t *)&spoof.mac, spoof.ip,
+- (target->ip ? (u_int8_t *)&target->mac : NULL),
+- target->ip);
++ (target->ip ? (u_int8_t *)&target->mac : brd_ha),
++ target->ip,
++ src_ha);
+ /* we have to wait a moment before sending the next packet */
+ sleep(1);
+ }
+@@ -174,7 +179,8 @@
+ arp_send(l, ARPOP_REPLY,
+ (u_int8_t *)&target->mac, target->ip,
+ (u_int8_t *)&spoof.mac,
+- spoof.ip);
++ spoof.ip,
++ src_ha);
+ sleep(1);
+ }
+ target++;
+@@ -193,6 +199,7 @@
+ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ int c;
+ int n_targets;
++ char *cleanup_src = NULL;
+
+ spoof.ip = 0;
+ intf = NULL;
+@@ -202,7 +209,7 @@
+ /* allocate enough memory for target list */
+ targets = calloc( argc+1, sizeof(struct host) );
+
+- while ((c = getopt(argc, argv, "ri:t:h?V")) != -1) {
++ while ((c = getopt(argc, argv, "ri:t:c:h?V")) != -1) {
+ switch (c) {
+ case 'i':
+ intf = optarg;
+@@ -214,6 +221,9 @@
+ case 'r':
+ poison_reverse = 1;
+ break;
++ case 'c':
++ cleanup_src = optarg;
++ break;
+ default:
+ usage();
+ }
+@@ -229,6 +239,29 @@
+ usage();
+ }
+
++ if (!cleanup_src || strcmp(cleanup_src, "own")==0) { /* default! */
++ /* only use our own hw address when cleaning up,
++ * not jeopardizing any bridges on the way to our
++ * target
++ */
++ cleanup_src_own = 1;
++ cleanup_src_host = 0;
++ } else if (strcmp(cleanup_src, "host")==0) {
++ /* only use the target hw address when cleaning up;
++ * this can screw up some bridges and scramble access
++ * for our own host, however it resets the arp table
++ * more reliably
++ */
++ cleanup_src_own = 0;
++ cleanup_src_host = 1;
++ } else if (strcmp(cleanup_src, "both")==0) {
++ cleanup_src_own = 1;
++ cleanup_src_host = 1;
++ } else {
++ errx(1, "Invalid parameter to -c: use 'own' (default), 'host' or 'both'.");
++ usage();
++ }
++
+ if ((spoof.ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
+ usage();
+
+@@ -253,6 +286,10 @@
+ }
+ }
+
++ if ((my_ha = (u_int8_t *)libnet_get_hwaddr(l)) == NULL) {
++ errx(1, "Unable to determine own mac address");
++ }
++
+ signal(SIGHUP, cleanup);
+ signal(SIGINT, cleanup);
+ signal(SIGTERM, cleanup);
+@@ -260,11 +297,12 @@
+ for (;;) {
+ struct host *target = targets;
+ while(target->ip) {
+- arp_send(l, ARPOP_REPLY, NULL, spoof.ip,
+- (target->ip ? (u_int8_t *)&target->mac : NULL),
+- target->ip);
++ arp_send(l, ARPOP_REPLY, my_ha, spoof.ip,
++ (target->ip ? (u_int8_t *)&target->mac : brd_ha),
++ target->ip,
++ my_ha);
+ if (poison_reverse) {
+- arp_send(l, ARPOP_REPLY, NULL, target->ip, (uint8_t *)&spoof.mac, spoof.ip);
++ arp_send(l, ARPOP_REPLY, my_ha, target->ip, (uint8_t *)&spoof.mac, spoof.ip, my_ha);
+ }
+ target++;
+ }
diff --git a/testing/dsniff/0004-arpspoof-mac-include.patch b/testing/dsniff/0004-arpspoof-mac-include.patch
new file mode 100644
index 0000000000..964484b662
--- /dev/null
+++ b/testing/dsniff/0004-arpspoof-mac-include.patch
@@ -0,0 +1,12 @@
+diff --git a/arpspoof.c b/arpspoof.c
+index ab127f9..681f809 100644
+--- a/arpspoof.c
++++ b/arpspoof.c
+@@ -23,6 +23,7 @@
+ #include <err.h>
+ #include <libnet.h>
+ #include <pcap.h>
++#include <net/ethernet.h>
+
+ #include "arp.h"
+ #include "version.h"
diff --git a/testing/dsniff/01_time.h.patch b/testing/dsniff/01_time.h.patch
new file mode 100644
index 0000000000..1cf570b070
--- /dev/null
+++ b/testing/dsniff/01_time.h.patch
@@ -0,0 +1,23 @@
+Author: Steve Kemp <skx@debian.org>
+Description: Include <time.h> to fix segfault on some architectures.
+Closes #315969
+--- a/msgsnarf.c 2011-06-19 17:14:25.023999385 -0500
++++ b/msgsnarf.c 2011-06-19 17:14:56.475999377 -0500
+@@ -23,6 +23,7 @@
+ #include <nids.h>
+ #include <pcap.h>
+ #include <pcaputil.h>
++#include <time.h>
+
+ #include "buf.h"
+ #include "decode.h"
+--- a/sshow.c 2011-06-19 17:14:24.843999385 -0500
++++ b/sshow.c 2011-06-19 17:14:56.475999377 -0500
+@@ -15,6 +15,7 @@
+
+ #include <sys/types.h>
+ #include <sys/times.h>
++#include <time.h>
+
+ #include <netinet/in_systm.h>
+ #include <netinet/in.h>
diff --git a/testing/dsniff/02_mailsnarf_corrupt.patch b/testing/dsniff/02_mailsnarf_corrupt.patch
new file mode 100644
index 0000000000..8a969533e1
--- /dev/null
+++ b/testing/dsniff/02_mailsnarf_corrupt.patch
@@ -0,0 +1,13 @@
+Author: Steve Kemp <skx@debian.org>
+Description: mailsnarf does not parse mail correctly, Closes #149330.
+--- a/mailsnarf.c 2011-06-19 17:14:23.839999384 -0500
++++ b/mailsnarf.c 2011-06-19 17:14:59.327999376 -0500
+@@ -178,7 +178,7 @@
+ if (smtp->state != SMTP_DATA) {
+ while ((i = buf_index(&buf, "\r\n", 2)) >= 0) {
+ line = buf_tok(&buf, NULL, i + 2);
+- line->base[line->end] = '\0';
++ line->base[line->end-1] = '\0';
+ p = buf_ptr(line);
+
+ if (strncasecmp(p, "RSET", 4) == 0) {
diff --git a/testing/dsniff/03_pcap_read_dump.patch b/testing/dsniff/03_pcap_read_dump.patch
new file mode 100644
index 0000000000..18369f9a85
--- /dev/null
+++ b/testing/dsniff/03_pcap_read_dump.patch
@@ -0,0 +1,531 @@
+Author: Joseph Battaglia <sephail@sephail.net> and Joshua Krage <jkrage@guisarme.us>
+Description: Allow the reading of saved PCAP capture files.
+Closes #153462
+Closes #298604
+--- a/dsniff.8 2011-06-19 17:14:20.847999386 -0500
++++ b/dsniff.8 2011-06-19 17:15:01.067999376 -0500
+@@ -10,7 +10,7 @@
+ .nf
+ .fi
+ \fBdsniff\fR [\fB-c\fR] [\fB-d\fR] [\fB-m\fR] [\fB-n\fR] [\fB-i
+-\fIinterface\fR] [\fB-s \fIsnaplen\fR] [\fB-f \fIservices\fR]
++\fIinterface\fR | \fB-p \fIpcapfile\fR] [\fB-s \fIsnaplen\fR] [\fB-f \fIservices\fR]
+ [\fB-t \fItrigger[,...]\fR]]
+ [\fB-r\fR|\fB-w\fR \fIsavefile\fR] [\fIexpression\fR]
+ .SH DESCRIPTION
+@@ -45,6 +45,9 @@
+ Do not resolve IP addresses to hostnames.
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Rather than processing the contents of packets observed upon the network
++process the given PCAP capture file.
+ .IP "\fB-s \fIsnaplen\fR"
+ Analyze at most the first \fIsnaplen\fR bytes of each TCP connection,
+ rather than the default of 1024.
+--- a/dsniff.c 2011-06-19 17:14:20.303999384 -0500
++++ b/dsniff.c 2011-06-19 17:15:01.071999376 -0500
+@@ -46,8 +46,9 @@
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: dsniff [-cdmn] [-i interface] [-s snaplen] [-f services]\n"
+- " [-t trigger[,...]] [-r|-w savefile] [expression]\n");
++ "Usage: dsniff [-cdmn] [-i interface | -p pcapfile] [-s snaplen]\n"
++ " [-f services] [-t trigger[,...]] [-r|-w savefile]\n"
++ " [expression]\n");
+ exit(1);
+ }
+
+@@ -79,7 +80,7 @@
+
+ services = savefile = triggers = NULL;
+
+- while ((c = getopt(argc, argv, "cdf:i:mnr:s:t:w:h?V")) != -1) {
++ while ((c = getopt(argc, argv, "cdf:i:mnp:r:s:t:w:h?V")) != -1) {
+ switch (c) {
+ case 'c':
+ Opt_client = 1;
+@@ -99,6 +100,9 @@
+ case 'n':
+ Opt_dns = 0;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ case 'r':
+ Opt_read = 1;
+ savefile = optarg;
+@@ -168,10 +172,23 @@
+ else nids_register_tcp(trigger_tcp);
+
+ if (nids_params.pcap_filter != NULL) {
+- warnx("listening on %s [%s]", nids_params.device,
+- nids_params.pcap_filter);
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s [%s]", nids_params.device,
++ nids_params.pcap_filter);
++ }
++ else {
++ warnx("using %s [%s]", nids_params.filename,
++ nids_params.pcap_filter);
++ }
++ }
++ else {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
+ }
+- else warnx("listening on %s", nids_params.device);
+
+ nids_run();
+
+--- a/filesnarf.8 2011-06-19 17:14:22.343999384 -0500
++++ b/filesnarf.8 2011-06-19 17:15:01.071999376 -0500
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBfilesnarf\fR [\fB-i \fIinterface\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
++\fBfilesnarf\fR [\fB-i \fIinterface\fR | \fB-p \fIpcapfile\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -18,6 +18,8 @@
+ .SH OPTIONS
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Process packets from the specified PCAP capture file instead of the network.
+ .IP \fB-v\fR
+ "Versus" mode. Invert the sense of matching, to select non-matching
+ files.
+--- a/filesnarf.c 2011-06-19 17:14:22.155999384 -0500
++++ b/filesnarf.c 2011-06-19 17:15:01.075999376 -0500
+@@ -51,7 +51,7 @@
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: filesnarf [-i interface] [[-v] pattern [expression]]\n");
++ "Usage: filesnarf [-i interface | -p pcapfile] [[-v] pattern [expression]]\n");
+ exit(1);
+ }
+
+@@ -464,11 +464,14 @@
+ extern int optind;
+ int c;
+
+- while ((c = getopt(argc, argv, "i:vh?V")) != -1) {
++ while ((c = getopt(argc, argv, "i:p:vh?V")) != -1) {
+ switch (c) {
+ case 'i':
+ nids_params.device = optarg;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ case 'v':
+ Opt_invert = 1;
+ break;
+@@ -498,11 +501,24 @@
+ nids_register_ip(decode_udp_nfs);
+ nids_register_tcp(decode_tcp_nfs);
+
+- if (nids_params.pcap_filter != NULL) {
+- warnx("listening on %s [%s]", nids_params.device,
+- nids_params.pcap_filter);
+- }
+- else warnx("listening on %s", nids_params.device);
++ if (nids_params.pcap_filter != NULL) {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s [%s]", nids_params.device,
++ nids_params.pcap_filter);
++ }
++ else {
++ warnx("using %s [%s]", nids_params.filename,
++ nids_params.pcap_filter);
++ }
++ }
++ else {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
++ }
+
+ nids_run();
+
+--- a/mailsnarf.8 2011-06-19 17:14:21.099999386 -0500
++++ b/mailsnarf.8 2011-06-19 17:15:01.079999376 -0500
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBmailsnarf\fR [\fB-i \fIinterface\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
++\fBmailsnarf\fR [\fB-i \fIinterface\fR | \fB-p \fIpcapfile\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -19,6 +19,8 @@
+ .SH OPTIONS
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Process packets from the specified PCAP capture file instead of the network.
+ .IP \fB-v\fR
+ "Versus" mode. Invert the sense of matching, to select non-matching
+ messages.
+--- a/mailsnarf.c 2011-06-19 17:14:59.327999376 -0500
++++ b/mailsnarf.c 2011-06-19 17:15:01.083999376 -0500
+@@ -59,7 +59,7 @@
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: mailsnarf [-i interface] [[-v] pattern [expression]]\n");
++ "Usage: mailsnarf [-i interface | -p pcapfile] [[-v] pattern [expression]]\n");
+ exit(1);
+ }
+
+@@ -344,11 +344,14 @@
+ extern int optind;
+ int c;
+
+- while ((c = getopt(argc, argv, "i:vh?V")) != -1) {
++ while ((c = getopt(argc, argv, "i:p:vh?V")) != -1) {
+ switch (c) {
+ case 'i':
+ nids_params.device = optarg;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ case 'v':
+ Opt_invert = 1;
+ break;
+@@ -378,10 +381,23 @@
+ nids_register_tcp(sniff_pop_session);
+
+ if (nids_params.pcap_filter != NULL) {
+- warnx("listening on %s [%s]", nids_params.device,
+- nids_params.pcap_filter);
+- }
+- else warnx("listening on %s", nids_params.device);
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s [%s]", nids_params.device,
++ nids_params.pcap_filter);
++ }
++ else {
++ warnx("using %s [%s]", nids_params.filename,
++ nids_params.pcap_filter);
++ }
++ }
++ else {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
++ }
+
+ nids_run();
+
+--- a/msgsnarf.8 2011-06-19 17:14:21.771999384 -0500
++++ b/msgsnarf.8 2011-06-19 17:15:01.087999376 -0500
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBmsgsnarf\fR [\fB-i \fIinterface\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
++\fBmsgsnarf\fR [\fB-i \fIinterface\fR | \fB-p \fIpcapfile\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -19,6 +19,8 @@
+ .SH OPTIONS
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Process packets from the specified PCAP capture file instead of the network.
+ .IP \fB-v\fR
+ "Versus" mode. Invert the sense of matching, to select non-matching
+ messages.
+--- a/msgsnarf.c 2011-06-19 17:14:56.475999377 -0500
++++ b/msgsnarf.c 2011-06-19 17:15:01.091999376 -0500
+@@ -45,7 +45,7 @@
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: msgsnarf [-i interface] [[-v] pattern [expression]]\n");
++ "Usage: msgsnarf [-i interface | -p pcapfile] [[-v] pattern [expression]]\n");
+ exit(1);
+ }
+
+@@ -633,11 +633,14 @@
+ extern int optind;
+ int c;
+
+- while ((c = getopt(argc, argv, "i:hv?V")) != -1) {
++ while ((c = getopt(argc, argv, "i:p:hv?V")) != -1) {
+ switch (c) {
+ case 'i':
+ nids_params.device = optarg;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ case 'v':
+ Opt_invert = 1;
+ break;
+@@ -666,11 +669,24 @@
+
+ nids_register_tcp(sniff_msgs);
+
+- if (nids_params.pcap_filter != NULL) {
+- warnx("listening on %s [%s]", nids_params.device,
+- nids_params.pcap_filter);
+- }
+- else warnx("listening on %s", nids_params.device);
++ if (nids_params.pcap_filter != NULL) {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s [%s]", nids_params.device,
++ nids_params.pcap_filter);
++ }
++ else {
++ warnx("using %s [%s]", nids_params.filename,
++ nids_params.pcap_filter);
++ }
++ }
++ else {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
++ }
+
+ nids_run();
+
+--- a/sshow.8 2011-06-19 17:14:18.839999384 -0500
++++ b/sshow.8 2011-06-19 17:15:01.095999376 -0500
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBsshow\fR [\fB-d\fR] [\fB-i \fIinterface\fR] [\fIexpression\fR]
++\fBsshow\fR [\fB-d\fR] [\fB-i \fIinterface\fR | \fB-p \fIpcapfile\fR] [\fIexpression\fR]
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -28,6 +28,8 @@
+ Enable verbose debugging output.
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Process packets from the specified PCAP capture file instead of the network.
+ .IP "\fIexpression\fR"
+ Specify a tcpdump(8) filter expression to select traffic to sniff.
+ .SH "SEE ALSO"
+--- a/sshow.c 2011-06-19 17:14:56.475999377 -0500
++++ b/sshow.c 2011-06-19 17:15:01.099999376 -0500
+@@ -82,7 +82,7 @@
+ static void
+ usage(void)
+ {
+- fprintf(stderr, "Usage: sshow [-d] [-i interface]\n");
++ fprintf(stderr, "Usage: sshow [-d] [-i interface | -p pcapfile]\n");
+ exit(1);
+ }
+
+@@ -616,7 +616,7 @@
+ extern int optind;
+ int c;
+
+- while ((c = getopt(argc, argv, "di:h?")) != -1) {
++ while ((c = getopt(argc, argv, "di:p:h?")) != -1) {
+ switch (c) {
+ case 'd':
+ debug++;
+@@ -624,6 +624,9 @@
+ case 'i':
+ nids_params.device = optarg;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ default:
+ usage();
+ break;
+@@ -652,11 +655,24 @@
+
+ nids_register_tcp(process_event);
+
+- if (nids_params.pcap_filter != NULL) {
+- warnx("listening on %s [%s]", nids_params.device,
+- nids_params.pcap_filter);
+- }
+- else warnx("listening on %s", nids_params.device);
++ if (nids_params.pcap_filter != NULL) {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s [%s]", nids_params.device,
++ nids_params.pcap_filter);
++ }
++ else {
++ warnx("using %s [%s]", nids_params.filename,
++ nids_params.pcap_filter);
++ }
++ }
++ else {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
++ }
+
+ nids_run();
+
+--- a/urlsnarf.8 2011-06-19 17:14:19.727999384 -0500
++++ b/urlsnarf.8 2011-06-19 17:15:01.099999376 -0500
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBurlsnarf\fR [\fB-n\fR] [\fB-i \fIinterface\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
++\fBurlsnarf\fR [\fB-n\fR] [\fB-i \fIinterface\fR | \fB-p \fIpcapfile\fR] [[\fB-v\fR] \fIpattern [\fIexpression\fR]]
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -21,6 +21,9 @@
+ .IP \fB-n\fR
+ Do not resolve IP addresses to hostnames.
+ .IP "\fB-i \fIinterface\fR"
++Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Process packets from the specified PCAP capture file instead of the network.
+ .IP \fB-v\fR
+ "Versus" mode. Invert the sense of matching, to select non-matching
+ URLs.
+--- a/urlsnarf.c 2011-06-19 17:14:19.323999384 -0500
++++ b/urlsnarf.c 2011-06-19 17:15:01.103999376 -0500
+@@ -41,7 +41,7 @@
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: urlsnarf [-n] [-i interface] [[-v] pattern [expression]]\n");
++ "Usage: urlsnarf [-n] [-i interface | -p pcapfile] [[-v] pattern [expression]]\n");
+ exit(1);
+ }
+
+@@ -201,11 +201,14 @@
+ extern int optind;
+ int c;
+
+- while ((c = getopt(argc, argv, "i:nvh?V")) != -1) {
++ while ((c = getopt(argc, argv, "i:p:nvh?V")) != -1) {
+ switch (c) {
+ case 'i':
+ nids_params.device = optarg;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ case 'n':
+ Opt_dns = 0;
+ break;
+@@ -238,8 +241,24 @@
+
+ nids_register_tcp(sniff_http_client);
+
+- warnx("listening on %s [%s]", nids_params.device,
+- nids_params.pcap_filter);
++ if (nids_params.pcap_filter != NULL) {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s [%s]", nids_params.device,
++ nids_params.pcap_filter);
++ }
++ else {
++ warnx("using %s [%s]", nids_params.filename,
++ nids_params.pcap_filter);
++ }
++ }
++ else {
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
++ }
+
+ nids_run();
+
+--- a/webspy.8 2011-06-19 17:14:18.319999386 -0500
++++ b/webspy.8 2011-06-19 17:15:01.107999376 -0500
+@@ -9,7 +9,7 @@
+ .na
+ .nf
+ .fi
+-\fBwebspy\fR [\fB-i \fIinterface\fR] \fIhost\fR
++\fBwebspy\fR [\fB-i \fIinterface\fR | \fB-p \fIpcapfile\fR] \fIhost\fR
+ .SH DESCRIPTION
+ .ad
+ .fi
+@@ -20,6 +20,8 @@
+ .SH OPTIONS
+ .IP "\fB-i \fIinterface\fR"
+ Specify the interface to listen on.
++.IP "\fB-p \fIpcapfile\fR"
++Process packets from the specified PCAP capture file instead of the network.
+ .IP \fIhost\fR
+ Specify the web client to spy on.
+ .SH "SEE ALSO"
+--- a/webspy.c 2011-06-19 17:14:21.395999384 -0500
++++ b/webspy.c 2011-06-19 17:15:01.111999376 -0500
+@@ -42,7 +42,7 @@
+ usage(void)
+ {
+ fprintf(stderr, "Version: " VERSION "\n"
+- "Usage: %s [-i interface] host\n", progname);
++ "Usage: %s [-i interface | -p pcapfile] host\n", progname);
+ exit(1);
+ }
+
+@@ -184,11 +184,14 @@
+ extern int optind;
+ int c;
+
+- while ((c = getopt(argc, argv, "i:h?V")) != -1) {
++ while ((c = getopt(argc, argv, "i:p:h?V")) != -1) {
+ switch (c) {
+ case 'i':
+ nids_params.device = optarg;
+ break;
++ case 'p':
++ nids_params.filename = optarg;
++ break;
+ default:
+ usage();
+ }
+@@ -216,7 +219,13 @@
+
+ nids_register_tcp(sniff_http_client);
+
+- warnx("listening on %s", nids_params.device);
++ if (nids_params.filename == NULL) {
++ warnx("listening on %s", nids_params.device);
++ }
++ else {
++ warnx("using %s", nids_params.filename);
++ }
++
+
+ nids_run();
+
diff --git a/testing/dsniff/04_multiple_intf.patch b/testing/dsniff/04_multiple_intf.patch
new file mode 100644
index 0000000000..24857c7cc1
--- /dev/null
+++ b/testing/dsniff/04_multiple_intf.patch
@@ -0,0 +1,52 @@
+Author: Steve Kemp <skx@debian.org>
+Description: Work with multiple interfaces, Closes #242369.
+--- a/arp.c 2011-06-19 17:14:13.607999387 -0500
++++ b/arp.c 2011-06-19 17:15:04.587999376 -0500
+@@ -39,7 +39,7 @@
+
+ #ifdef BSD
+ int
+-arp_cache_lookup(in_addr_t ip, struct ether_addr *ether)
++arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char* linf)
+ {
+ int mib[6];
+ size_t len;
+@@ -91,7 +91,7 @@
+ #endif
+
+ int
+-arp_cache_lookup(in_addr_t ip, struct ether_addr *ether)
++arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char* lif)
+ {
+ int sock;
+ struct arpreq ar;
+@@ -99,7 +99,7 @@
+
+ memset((char *)&ar, 0, sizeof(ar));
+ #ifdef __linux__
+- strncpy(ar.arp_dev, "eth0", sizeof(ar.arp_dev)); /* XXX - *sigh* */
++ strncpy(ar.arp_dev, lif, strlen(lif));
+ #endif
+ sin = (struct sockaddr_in *)&ar.arp_pa;
+ sin->sin_family = AF_INET;
+--- a/arp.h 2011-06-19 17:14:13.003999387 -0500
++++ b/arp.h 2011-06-19 17:15:04.587999376 -0500
+@@ -11,6 +11,6 @@
+ #ifndef _ARP_H_
+ #define _ARP_H_
+
+-int arp_cache_lookup(in_addr_t ip, struct ether_addr *ether);
++int arp_cache_lookup(in_addr_t ip, struct ether_addr *ether, const char* linf);
+
+ #endif /* _ARP_H_ */
+--- a/arpspoof.c 2011-06-19 17:14:13.311999387 -0500
++++ b/arpspoof.c 2011-06-19 17:15:04.591999376 -0500
+@@ -113,7 +113,7 @@
+ int i = 0;
+
+ do {
+- if (arp_cache_lookup(ip, mac) == 0)
++ if (arp_cache_lookup(ip, mac, intf) == 0)
+ return (1);
+ #ifdef __linux__
+ /* XXX - force the kernel to arp. feh. */
diff --git a/testing/dsniff/05_amd64_fix.patch b/testing/dsniff/05_amd64_fix.patch
new file mode 100644
index 0000000000..22768c25b1
--- /dev/null
+++ b/testing/dsniff/05_amd64_fix.patch
@@ -0,0 +1,217 @@
+Author: Steve Kemp <skx@debian.org>
+Description: Compile under AMD64, Closes #254002.
+--- a/configure 2011-06-19 17:14:11.327999387 -0500
++++ b/configure 2011-06-19 17:15:06.667999375 -0500
+@@ -2667,15 +2667,62 @@
+ echo "$ac_t""no" 1>&6
+ fi
+
++echo $ac_n "checking for __dn_expand in -lresolv""... $ac_c" 1>&6
++echo "configure:2672: checking for __dn_expand in -lresolv" >&5
++ac_lib_var=`echo resolv'_'__dn_expand | sed 'y%./+-%__p_%'`
++if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
++ echo $ac_n "(cached) $ac_c" 1>&6
++else
++ ac_save_LIBS="$LIBS"
++LIBS="-lresolv $LIBS"
++cat > conftest.$ac_ext <<EOF
++#line 2680 "configure"
++#include "confdefs.h"
++/* Override any gcc2 internal prototype to avoid an error. */
++/* We use char because int might match the return type of a gcc2
++ builtin and then its argument prototype would still apply. */
++char __dn_expand();
++
++int main() {
++__dn_expand()
++; return 0; }
++EOF
++if { (eval echo configure:2691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++ rm -rf conftest*
++ eval "ac_cv_lib_$ac_lib_var=yes"
++else
++ echo "configure: failed program was:" >&5
++ cat conftest.$ac_ext >&5
++ rm -rf conftest*
++ eval "ac_cv_lib_$ac_lib_var=no"
++fi
++rm -f conftest*
++LIBS="$ac_save_LIBS"
++
++fi
++if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
++ echo "$ac_t""yes" 1>&6
++ ac_tr_lib=HAVE_LIB`echo resolv | sed -e 's/[^a-zA-Z0-9_]/_/g' \
++ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'`
++ cat >> confdefs.h <<EOF
++#define $ac_tr_lib 1
++EOF
++
++ LIBS="-lresolv $LIBS"
++
++else
++ echo "$ac_t""no" 1>&6
++fi
++
+ for ac_func in dirname strlcpy strlcat strsep
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:2674: checking for $ac_func" >&5
++echo "configure:2721: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2679 "configure"
++#line 2726 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+@@ -2698,7 +2745,7 @@
+
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2702: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2749: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2728,12 +2775,12 @@
+ for ac_func in MD5Update
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:2732: checking for $ac_func" >&5
++echo "configure:2779: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2737 "configure"
++#line 2784 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+@@ -2756,7 +2803,7 @@
+
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2760: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2807: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2788,12 +2835,12 @@
+ for ac_func in warnx
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:2792: checking for $ac_func" >&5
++echo "configure:2839: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2797 "configure"
++#line 2844 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+@@ -2816,7 +2863,7 @@
+
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2820: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2867: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2848,12 +2895,12 @@
+ for ac_func in ether_ntoa
+ do
+ echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
+-echo "configure:2852: checking for $ac_func" >&5
++echo "configure:2899: checking for $ac_func" >&5
+ if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
+ echo $ac_n "(cached) $ac_c" 1>&6
+ else
+ cat > conftest.$ac_ext <<EOF
+-#line 2857 "configure"
++#line 2904 "configure"
+ #include "confdefs.h"
+ /* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func(); below. */
+@@ -2876,7 +2923,7 @@
+
+ ; return 0; }
+ EOF
+-if { (eval echo configure:2880: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
++if { (eval echo configure:2927: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+ rm -rf conftest*
+ eval "ac_cv_func_$ac_func=yes"
+ else
+@@ -2912,7 +2959,7 @@
+ fi
+
+ echo $ac_n "checking for Berkeley DB with 1.85 compatibility""... $ac_c" 1>&6
+-echo "configure:2916: checking for Berkeley DB with 1.85 compatibility" >&5
++echo "configure:2963: checking for Berkeley DB with 1.85 compatibility" >&5
+ # Check whether --with-db or --without-db was given.
+ if test "${with_db+set}" = set; then
+ withval="$with_db"
+@@ -3015,7 +3062,7 @@
+
+
+ echo $ac_n "checking for libpcap""... $ac_c" 1>&6
+-echo "configure:3019: checking for libpcap" >&5
++echo "configure:3066: checking for libpcap" >&5
+ # Check whether --with-libpcap or --without-libpcap was given.
+ if test "${with_libpcap+set}" = set; then
+ withval="$with_libpcap"
+@@ -3063,7 +3110,7 @@
+
+
+ echo $ac_n "checking for libnet""... $ac_c" 1>&6
+-echo "configure:3067: checking for libnet" >&5
++echo "configure:3114: checking for libnet" >&5
+ # Check whether --with-libnet or --without-libnet was given.
+ if test "${with_libnet+set}" = set; then
+ withval="$with_libnet"
+@@ -3110,7 +3157,7 @@
+
+
+ echo $ac_n "checking for libnids""... $ac_c" 1>&6
+-echo "configure:3114: checking for libnids" >&5
++echo "configure:3161: checking for libnids" >&5
+ # Check whether --with-libnids or --without-libnids was given.
+ if test "${with_libnids+set}" = set; then
+ withval="$with_libnids"
+@@ -3152,9 +3199,9 @@
+ save_cppflags="$CPPFLAGS"
+ CPPFLAGS="$NIDSINC"
+ echo $ac_n "checking whether libnids version is good""... $ac_c" 1>&6
+-echo "configure:3156: checking whether libnids version is good" >&5
++echo "configure:3203: checking whether libnids version is good" >&5
+ cat > conftest.$ac_ext <<EOF
+-#line 3158 "configure"
++#line 3205 "configure"
+ #include "confdefs.h"
+ #include <nids.h>
+ EOF
+@@ -3173,7 +3220,7 @@
+
+
+ echo $ac_n "checking for OpenSSL""... $ac_c" 1>&6
+-echo "configure:3177: checking for OpenSSL" >&5
++echo "configure:3224: checking for OpenSSL" >&5
+ # Check whether --with-openssl or --without-openssl was given.
+ if test "${with_openssl+set}" = set; then
+ withval="$with_openssl"
+--- a/configure.in 2011-06-19 17:14:11.195999387 -0500
++++ b/configure.in 2011-06-19 17:15:06.683999375 -0500
+@@ -57,6 +57,7 @@
+ AC_CHECK_LIB(nsl, gethostbyname)
+ dnl XXX - feh, everything except OpenBSD sux.
+ AC_CHECK_LIB(resolv, dn_expand)
++AC_CHECK_LIB(resolv, __dn_expand)
+ AC_REPLACE_FUNCS(dirname strlcpy strlcat strsep)
+ needmd5=no
+ AC_CHECK_FUNCS(MD5Update, , [needmd5=yes])
diff --git a/testing/dsniff/06_urlsnarf_zeropad.patch b/testing/dsniff/06_urlsnarf_zeropad.patch
new file mode 100644
index 0000000000..be1c4beced
--- /dev/null
+++ b/testing/dsniff/06_urlsnarf_zeropad.patch
@@ -0,0 +1,13 @@
+Author: Steve Kemp <skx@debian.org>
+Description: urlsnarf: zero-pad date, Closes #298605.
+--- a/urlsnarf.c 2011-06-19 17:15:01.103999376 -0500
++++ b/urlsnarf.c 2011-06-19 17:15:08.631999375 -0500
+@@ -68,7 +68,7 @@
+ t->tm_hour - gmt.tm_hour);
+ tz = hours * 60 + t->tm_min - gmt.tm_min;
+
+- len = strftime(tstr, sizeof(tstr), "%e/%b/%Y:%X", t);
++ len = strftime(tstr, sizeof(tstr), "%d/%b/%Y:%X", t);
+ if (len < 0 || len > sizeof(tstr) - 5)
+ return (NULL);
+
diff --git a/testing/dsniff/07_libnet_1.1.patch b/testing/dsniff/07_libnet_1.1.patch
new file mode 100644
index 0000000000..6cf86f0baf
--- /dev/null
+++ b/testing/dsniff/07_libnet_1.1.patch
@@ -0,0 +1,903 @@
+Author: Faidon Liambotis <paravoid@debian.org>
+Description: Use libnet v1.1 instead of v1.0
+--- a/arpspoof.c 2011-06-19 17:15:04.591999376 -0500
++++ b/arpspoof.c 2011-06-19 17:15:10.511999375 -0500
+@@ -27,7 +27,7 @@
+
+ extern char *ether_ntoa(struct ether_addr *);
+
+-static struct libnet_link_int *llif;
++static libnet_t *l;
+ static struct ether_addr spoof_mac, target_mac;
+ static in_addr_t spoof_ip, target_ip;
+ static char *intf;
+@@ -41,47 +41,49 @@
+ }
+
+ static int
+-arp_send(struct libnet_link_int *llif, char *dev,
+- int op, u_char *sha, in_addr_t spa, u_char *tha, in_addr_t tpa)
++arp_send(libnet_t *l, int op, u_int8_t *sha,
++ in_addr_t spa, u_int8_t *tha, in_addr_t tpa)
+ {
+- char ebuf[128];
+- u_char pkt[60];
+-
++ int retval;
++
+ if (sha == NULL &&
+- (sha = (u_char *)libnet_get_hwaddr(llif, dev, ebuf)) == NULL) {
++ (sha = (u_int8_t *)libnet_get_hwaddr(l)) == NULL) {
+ return (-1);
+ }
+ if (spa == 0) {
+- if ((spa = libnet_get_ipaddr(llif, dev, ebuf)) == 0)
++ if ((spa = libnet_get_ipaddr4(l)) == -1)
+ return (-1);
+- spa = htonl(spa); /* XXX */
+ }
+ if (tha == NULL)
+ tha = "\xff\xff\xff\xff\xff\xff";
+
+- libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, pkt);
++ libnet_autobuild_arp(op, sha, (u_int8_t *)&spa,
++ tha, (u_int8_t *)&tpa, l);
++ libnet_build_ethernet(tha, sha, ETHERTYPE_ARP, NULL, 0, l, 0);
+
+- libnet_build_arp(ARPHRD_ETHER, ETHERTYPE_IP, ETHER_ADDR_LEN, 4,
+- op, sha, (u_char *)&spa, tha, (u_char *)&tpa,
+- NULL, 0, pkt + ETH_H);
+-
+ fprintf(stderr, "%s ",
+ ether_ntoa((struct ether_addr *)sha));
+
+ if (op == ARPOP_REQUEST) {
+ fprintf(stderr, "%s 0806 42: arp who-has %s tell %s\n",
+ ether_ntoa((struct ether_addr *)tha),
+- libnet_host_lookup(tpa, 0),
+- libnet_host_lookup(spa, 0));
++ libnet_addr2name4(tpa, LIBNET_DONT_RESOLVE),
++ libnet_addr2name4(spa, LIBNET_DONT_RESOLVE));
+ }
+ else {
+ fprintf(stderr, "%s 0806 42: arp reply %s is-at ",
+ ether_ntoa((struct ether_addr *)tha),
+- libnet_host_lookup(spa, 0));
++ libnet_addr2name4(spa, LIBNET_DONT_RESOLVE));
+ fprintf(stderr, "%s\n",
+ ether_ntoa((struct ether_addr *)sha));
+ }
+- return (libnet_write_link_layer(llif, dev, pkt, sizeof(pkt)) == sizeof(pkt));
++ retval = libnet_write(l);
++ if (retval)
++ fprintf(stderr, "%s", libnet_geterror(l));
++
++ libnet_clear_packet(l);
++
++ return retval;
+ }
+
+ #ifdef __linux__
+@@ -119,7 +121,7 @@
+ /* XXX - force the kernel to arp. feh. */
+ arp_force(ip);
+ #else
+- arp_send(llif, intf, ARPOP_REQUEST, NULL, 0, NULL, ip);
++ arp_send(l, ARPOP_REQUEST, NULL, 0, NULL, ip);
+ #endif
+ sleep(1);
+ }
+@@ -136,9 +138,9 @@
+ if (arp_find(spoof_ip, &spoof_mac)) {
+ for (i = 0; i < 3; i++) {
+ /* XXX - on BSD, requires ETHERSPOOF kernel. */
+- arp_send(llif, intf, ARPOP_REPLY,
+- (u_char *)&spoof_mac, spoof_ip,
+- (target_ip ? (u_char *)&target_mac : NULL),
++ arp_send(l, ARPOP_REPLY,
++ (u_int8_t *)&spoof_mac, spoof_ip,
++ (target_ip ? (u_int8_t *)&target_mac : NULL),
+ target_ip);
+ sleep(1);
+ }
+@@ -151,7 +153,8 @@
+ {
+ extern char *optarg;
+ extern int optind;
+- char ebuf[PCAP_ERRBUF_SIZE];
++ char pcap_ebuf[PCAP_ERRBUF_SIZE];
++ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ int c;
+
+ intf = NULL;
+@@ -163,7 +166,7 @@
+ intf = optarg;
+ break;
+ case 't':
+- if ((target_ip = libnet_name_resolve(optarg, 1)) == -1)
++ if ((target_ip = libnet_name2addr4(l, optarg, LIBNET_RESOLVE)) == -1)
+ usage();
+ break;
+ default:
+@@ -176,26 +179,26 @@
+ if (argc != 1)
+ usage();
+
+- if ((spoof_ip = libnet_name_resolve(argv[0], 1)) == -1)
++ if ((spoof_ip = libnet_name2addr4(l, argv[0], LIBNET_RESOLVE)) == -1)
+ usage();
+
+- if (intf == NULL && (intf = pcap_lookupdev(ebuf)) == NULL)
+- errx(1, "%s", ebuf);
++ if (intf == NULL && (intf = pcap_lookupdev(pcap_ebuf)) == NULL)
++ errx(1, "%s", pcap_ebuf);
+
+- if ((llif = libnet_open_link_interface(intf, ebuf)) == 0)
+- errx(1, "%s", ebuf);
++ if ((l = libnet_init(LIBNET_LINK, intf, libnet_ebuf)) == NULL)
++ errx(1, "%s", libnet_ebuf);
+
+ if (target_ip != 0 && !arp_find(target_ip, &target_mac))
+ errx(1, "couldn't arp for host %s",
+- libnet_host_lookup(target_ip, 0));
++ libnet_addr2name4(target_ip, LIBNET_DONT_RESOLVE));
+
+ signal(SIGHUP, cleanup);
+ signal(SIGINT, cleanup);
+ signal(SIGTERM, cleanup);
+
+ for (;;) {
+- arp_send(llif, intf, ARPOP_REPLY, NULL, spoof_ip,
+- (target_ip ? (u_char *)&target_mac : NULL),
++ arp_send(l, ARPOP_REPLY, NULL, spoof_ip,
++ (target_ip ? (u_int8_t *)&target_mac : NULL),
+ target_ip);
+ sleep(2);
+ }
+--- a/dnsspoof.c 2011-06-19 17:14:04.651999389 -0500
++++ b/dnsspoof.c 2011-06-19 17:15:10.515999375 -0500
+@@ -38,7 +38,7 @@
+
+ pcap_t *pcap_pd = NULL;
+ int pcap_off = -1;
+-int lnet_sock = -1;
++libnet_t *l;
+ u_long lnet_ip = -1;
+
+ static void
+@@ -90,19 +90,18 @@
+ dns_init(char *dev, char *filename)
+ {
+ FILE *f;
+- struct libnet_link_int *llif;
++ libnet_t *l;
++ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ struct dnsent *de;
+ char *ip, *name, buf[1024];
+
+- if ((llif = libnet_open_link_interface(dev, buf)) == NULL)
+- errx(1, "%s", buf);
++ if ((l = libnet_init(LIBNET_LINK, dev, libnet_ebuf)) == NULL)
++ errx(1, "%s", libnet_ebuf);
+
+- if ((lnet_ip = libnet_get_ipaddr(llif, dev, buf)) == -1)
+- errx(1, "%s", buf);
++ if ((lnet_ip = libnet_get_ipaddr4(l)) == -1)
++ errx(1, "%s", libnet_geterror(l));
+
+- lnet_ip = htonl(lnet_ip);
+-
+- libnet_close_link_interface(llif);
++ libnet_destroy(l);
+
+ SLIST_INIT(&dns_entries);
+
+@@ -180,7 +179,7 @@
+ static void
+ dns_spoof(u_char *u, const struct pcap_pkthdr *pkthdr, const u_char *pkt)
+ {
+- struct libnet_ip_hdr *ip;
++ struct libnet_ipv4_hdr *ip;
+ struct libnet_udp_hdr *udp;
+ HEADER *dns;
+ char name[MAXHOSTNAMELEN];
+@@ -189,7 +188,7 @@
+ in_addr_t dst;
+ u_short type, class;
+
+- ip = (struct libnet_ip_hdr *)(pkt + pcap_off);
++ ip = (struct libnet_ipv4_hdr *)(pkt + pcap_off);
+ udp = (struct libnet_udp_hdr *)(pkt + pcap_off + (ip->ip_hl * 4));
+ dns = (HEADER *)(udp + 1);
+ p = (u_char *)(dns + 1);
+@@ -212,7 +211,7 @@
+ if (class != C_IN)
+ return;
+
+- p = buf + IP_H + UDP_H + dnslen;
++ p = buf + dnslen;
+
+ if (type == T_A) {
+ if ((dst = dns_lookup_a(name)) == -1)
+@@ -234,38 +233,38 @@
+ anslen += 12;
+ }
+ else return;
+-
+- libnet_build_ip(UDP_H + dnslen + anslen, 0, libnet_get_prand(PRu16),
+- 0, 64, IPPROTO_UDP, ip->ip_dst.s_addr,
+- ip->ip_src.s_addr, NULL, 0, buf);
+-
+- libnet_build_udp(ntohs(udp->uh_dport), ntohs(udp->uh_sport),
+- NULL, dnslen + anslen, buf + IP_H);
+
+- memcpy(buf + IP_H + UDP_H, (u_char *)dns, dnslen);
++ memcpy(buf, (u_char *)dns, dnslen);
+
+- dns = (HEADER *)(buf + IP_H + UDP_H);
++ dns = (HEADER *)buf;
+ dns->qr = dns->ra = 1;
+ if (type == T_PTR) dns->aa = 1;
+ dns->ancount = htons(1);
+
+ dnslen += anslen;
++
++ libnet_clear_packet(l);
++ libnet_build_udp(ntohs(udp->uh_dport), ntohs(udp->uh_sport),
++ LIBNET_UDP_H + dnslen, 0,
++ (u_int8_t *)buf, dnslen, l, 0);
++
++ libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_UDP_H + dnslen, 0,
++ libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_UDP, 0,
++ ip->ip_dst.s_addr, ip->ip_src.s_addr, NULL, 0, l, 0);
+
+- libnet_do_checksum(buf, IPPROTO_UDP, UDP_H + dnslen);
+-
+- if (libnet_write_ip(lnet_sock, buf, IP_H + UDP_H + dnslen) < 0)
++ if (libnet_write(l) < 0)
+ warn("write");
+
+ fprintf(stderr, "%s.%d > %s.%d: %d+ %s? %s\n",
+- libnet_host_lookup(ip->ip_src.s_addr, 0), ntohs(udp->uh_sport),
+- libnet_host_lookup(ip->ip_dst.s_addr, 0), ntohs(udp->uh_dport),
++ libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(udp->uh_sport),
++ libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(udp->uh_dport),
+ ntohs(dns->id), type == T_A ? "A" : "PTR", name);
+ }
+
+ static void
+ cleanup(int sig)
+ {
+- libnet_close_raw_sock(lnet_sock);
++ libnet_destroy(l);
+ pcap_close(pcap_pd);
+ exit(0);
+ }
+@@ -276,6 +275,7 @@
+ extern char *optarg;
+ extern int optind;
+ char *p, *dev, *hosts, buf[1024];
++ char ebuf[LIBNET_ERRBUF_SIZE];
+ int i;
+
+ dev = hosts = NULL;
+@@ -306,7 +306,7 @@
+ strlcpy(buf, p, sizeof(buf));
+ }
+ else snprintf(buf, sizeof(buf), "udp dst port 53 and not src %s",
+- libnet_host_lookup(lnet_ip, 0));
++ libnet_addr2name4(lnet_ip, LIBNET_DONT_RESOLVE));
+
+ if ((pcap_pd = pcap_init(dev, buf, 128)) == NULL)
+ errx(1, "couldn't initialize sniffing");
+@@ -314,10 +314,10 @@
+ if ((pcap_off = pcap_dloff(pcap_pd)) < 0)
+ errx(1, "couldn't determine link layer offset");
+
+- if ((lnet_sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
++ if ((l = libnet_init(LIBNET_RAW4, dev, ebuf)) == NULL)
+ errx(1, "couldn't initialize sending");
+
+- libnet_seed_prand();
++ libnet_seed_prand(l);
+
+ signal(SIGHUP, cleanup);
+ signal(SIGINT, cleanup);
+--- a/filesnarf.c 2011-06-19 17:15:01.075999376 -0500
++++ b/filesnarf.c 2011-06-19 17:15:10.519999375 -0500
+@@ -134,8 +134,8 @@
+ int fd;
+
+ warnx("%s.%d > %s.%d: %s (%d@%d)",
+- libnet_host_lookup(addr->daddr, 0), addr->dest,
+- libnet_host_lookup(addr->saddr, 0), addr->source,
++ libnet_addr2name4(addr->daddr, LIBNET_DONT_RESOLVE), addr->dest,
++ libnet_addr2name4(addr->saddr, LIBNET_DONT_RESOLVE), addr->source,
+ ma->filename, len, ma->offset);
+
+ if ((fd = open(ma->filename, O_WRONLY|O_CREAT, 0644)) >= 0) {
+@@ -353,7 +353,7 @@
+ }
+
+ static void
+-decode_udp_nfs(struct libnet_ip_hdr *ip)
++decode_udp_nfs(struct libnet_ipv4_hdr *ip)
+ {
+ static struct tuple4 addr;
+ struct libnet_udp_hdr *udp;
+--- a/macof.c 2011-06-19 17:14:04.959999389 -0500
++++ b/macof.c 2011-06-19 17:15:10.523999375 -0500
+@@ -48,8 +48,8 @@
+ static void
+ gen_mac(u_char *mac)
+ {
+- *((in_addr_t *)mac) = libnet_get_prand(PRu32);
+- *((u_short *)(mac + 4)) = libnet_get_prand(PRu16);
++ *((in_addr_t *)mac) = libnet_get_prand(LIBNET_PRu32);
++ *((u_short *)(mac + 4)) = libnet_get_prand(LIBNET_PRu16);
+ }
+
+ int
+@@ -59,22 +59,23 @@
+ extern int optind;
+ int c, i;
+ struct libnet_link_int *llif;
+- char ebuf[PCAP_ERRBUF_SIZE];
++ char pcap_ebuf[PCAP_ERRBUF_SIZE];
++ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
+ u_char sha[ETHER_ADDR_LEN], tha[ETHER_ADDR_LEN];
+ in_addr_t src, dst;
+ u_short sport, dport;
+ u_int32_t seq;
+- u_char pkt[ETH_H + IP_H + TCP_H];
++ libnet_t *l;
+
+ while ((c = getopt(argc, argv, "vs:d:e:x:y:i:n:h?V")) != -1) {
+ switch (c) {
+ case 'v':
+ break;
+ case 's':
+- Src = libnet_name_resolve(optarg, 0);
++ Src = libnet_name2addr4(l, optarg, 0);
+ break;
+ case 'd':
+- Dst = libnet_name_resolve(optarg, 0);
++ Dst = libnet_name2addr4(l, optarg, 0);
+ break;
+ case 'e':
+ Tha = (u_char *)ether_aton(optarg);
+@@ -101,13 +102,13 @@
+ if (argc != 0)
+ usage();
+
+- if (!Intf && (Intf = pcap_lookupdev(ebuf)) == NULL)
+- errx(1, "%s", ebuf);
++ if (!Intf && (Intf = pcap_lookupdev(pcap_ebuf)) == NULL)
++ errx(1, "%s", pcap_ebuf);
+
+- if ((llif = libnet_open_link_interface(Intf, ebuf)) == 0)
+- errx(1, "%s", ebuf);
++ if ((l = libnet_init(LIBNET_LINK, Intf, libnet_ebuf)) == NULL)
++ errx(1, "%s", libnet_ebuf);
+
+- libnet_seed_prand();
++ libnet_seed_prand(l);
+
+ for (i = 0; i != Repeat; i++) {
+
+@@ -117,39 +118,39 @@
+ else memcpy(tha, Tha, sizeof(tha));
+
+ if (Src != 0) src = Src;
+- else src = libnet_get_prand(PRu32);
++ else src = libnet_get_prand(LIBNET_PRu32);
+
+ if (Dst != 0) dst = Dst;
+- else dst = libnet_get_prand(PRu32);
++ else dst = libnet_get_prand(LIBNET_PRu32);
+
+ if (Sport != 0) sport = Sport;
+- else sport = libnet_get_prand(PRu16);
++ else sport = libnet_get_prand(LIBNET_PRu16);
+
+ if (Dport != 0) dport = Dport;
+- else dport = libnet_get_prand(PRu16);
++ else dport = libnet_get_prand(LIBNET_PRu16);
+
+- seq = libnet_get_prand(PRu32);
+-
+- libnet_build_ethernet(tha, sha, ETHERTYPE_IP, NULL, 0, pkt);
+-
+- libnet_build_ip(TCP_H, 0, libnet_get_prand(PRu16), 0, 64,
+- IPPROTO_TCP, src, dst, NULL, 0, pkt + ETH_H);
++ seq = libnet_get_prand(LIBNET_PRu32);
+
+ libnet_build_tcp(sport, dport, seq, 0, TH_SYN, 512,
+- 0, NULL, 0, pkt + ETH_H + IP_H);
++ 0, 0, LIBNET_TCP_H, NULL, 0, l, 0);
+
+- libnet_do_checksum(pkt + ETH_H, IPPROTO_IP, IP_H);
+- libnet_do_checksum(pkt + ETH_H, IPPROTO_TCP, TCP_H);
++ libnet_build_ipv4(LIBNET_TCP_H, 0,
++ libnet_get_prand(LIBNET_PRu16), 0, 64,
++ IPPROTO_TCP, 0, src, dst, NULL, 0, l, 0);
+
+- if (libnet_write_link_layer(llif, Intf, pkt, sizeof(pkt)) < 0)
++ libnet_build_ethernet(tha, sha, ETHERTYPE_IP, NULL, 0, l, 0);
++
++ if (libnet_write(l) < 0)
+ errx(1, "write");
+
++ libnet_clear_packet(l);
++
+ fprintf(stderr, "%s ",
+ ether_ntoa((struct ether_addr *)sha));
+ fprintf(stderr, "%s %s.%d > %s.%d: S %u:%u(0) win 512\n",
+ ether_ntoa((struct ether_addr *)tha),
+- libnet_host_lookup(Src, 0), sport,
+- libnet_host_lookup(Dst, 0), dport, seq, seq);
++ libnet_addr2name4(Src, 0), sport,
++ libnet_addr2name4(Dst, 0), dport, seq, seq);
+ }
+ exit(0);
+ }
+--- a/record.c 2011-06-19 17:14:06.627999389 -0500
++++ b/record.c 2011-06-19 17:15:10.523999375 -0500
+@@ -65,8 +65,8 @@
+ tm = localtime(&rec->time);
+ strftime(tstr, sizeof(tstr), "%x %X", tm);
+
+- srcp = libnet_host_lookup(rec->src, Opt_dns);
+- dstp = libnet_host_lookup(rec->dst, Opt_dns);
++ srcp = libnet_addr2name4(rec->src, Opt_dns);
++ dstp = libnet_addr2name4(rec->dst, Opt_dns);
+
+ if ((pr = getprotobynumber(rec->proto)) == NULL)
+ protop = "unknown";
+--- a/sshmitm.c 2011-06-19 17:14:05.687999389 -0500
++++ b/sshmitm.c 2011-06-19 17:15:10.527999375 -0500
+@@ -389,7 +389,7 @@
+ if (argc < 1)
+ usage();
+
+- if ((ip = libnet_name_resolve(argv[0], 1)) == -1)
++ if ((ip = libnet_name2addr4(NULL, argv[0], LIBNET_RESOLVE)) == -1)
+ usage();
+
+ if (argc == 2 && (rport = atoi(argv[1])) == 0)
+--- a/tcpkill.c 2011-06-19 17:14:05.823999389 -0500
++++ b/tcpkill.c 2011-06-19 17:15:10.535999375 -0500
+@@ -39,17 +39,18 @@
+ static void
+ tcp_kill_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
+ {
+- struct libnet_ip_hdr *ip;
++ struct libnet_ipv4_hdr *ip;
+ struct libnet_tcp_hdr *tcp;
+- u_char ctext[64], buf[IP_H + TCP_H];
++ u_char ctext[64];
+ u_int32_t seq, win;
+- int i, *sock, len;
++ int i, len;
++ libnet_t *l;
+
+- sock = (int *)user;
++ l = (libnet_t *)user;
+ pkt += pcap_off;
+ len = pcap->caplen - pcap_off;
+
+- ip = (struct libnet_ip_hdr *)pkt;
++ ip = (struct libnet_ipv4_hdr *)pkt;
+ if (ip->ip_p != IPPROTO_TCP)
+ return;
+
+@@ -57,34 +58,31 @@
+ if (tcp->th_flags & (TH_SYN|TH_FIN|TH_RST))
+ return;
+
+- libnet_build_ip(TCP_H, 0, 0, 0, 64, IPPROTO_TCP,
+- ip->ip_dst.s_addr, ip->ip_src.s_addr,
+- NULL, 0, buf);
+-
+- libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
+- 0, 0, TH_RST, 0, 0, NULL, 0, buf + IP_H);
+-
+ seq = ntohl(tcp->th_ack);
+ win = ntohs(tcp->th_win);
+
+ snprintf(ctext, sizeof(ctext), "%s:%d > %s:%d:",
+- libnet_host_lookup(ip->ip_src.s_addr, 0),
++ libnet_addr2name4(ip->ip_src.s_addr, LIBNET_DONT_RESOLVE),
+ ntohs(tcp->th_sport),
+- libnet_host_lookup(ip->ip_dst.s_addr, 0),
++ libnet_addr2name4(ip->ip_dst.s_addr, LIBNET_DONT_RESOLVE),
+ ntohs(tcp->th_dport));
+
+- ip = (struct libnet_ip_hdr *)buf;
+- tcp = (struct libnet_tcp_hdr *)(ip + 1);
+-
+ for (i = 0; i < Opt_severity; i++) {
+- ip->ip_id = libnet_get_prand(PRu16);
+ seq += (i * win);
+- tcp->th_seq = htonl(seq);
+
+- libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
++ libnet_clear_packet(l);
++
++ libnet_build_tcp(ntohs(tcp->th_dport), ntohs(tcp->th_sport),
++ seq, 0, TH_RST, 0, 0, 0, LIBNET_TCP_H,
++ NULL, 0, l, 0);
++
++ libnet_build_ipv4(LIBNET_IPV4_H + LIBNET_TCP_H, 0,
++ libnet_get_prand(LIBNET_PRu16), 0, 64,
++ IPPROTO_TCP, 0, ip->ip_dst.s_addr,
++ ip->ip_src.s_addr, NULL, 0, l, 0);
+
+- if (libnet_write_ip(*sock, buf, sizeof(buf)) < 0)
+- warn("write_ip");
++ if (libnet_write(l) < 0)
++ warn("write");
+
+ fprintf(stderr, "%s R %lu:%lu(0) win 0\n", ctext, seq, seq);
+ }
+@@ -95,8 +93,10 @@
+ {
+ extern char *optarg;
+ extern int optind;
+- int c, sock;
++ int c;
+ char *p, *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
++ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
++ libnet_t *l;
+ pcap_t *pd;
+
+ intf = NULL;
+@@ -136,14 +136,14 @@
+ if ((pcap_off = pcap_dloff(pd)) < 0)
+ errx(1, "couldn't determine link layer offset");
+
+- if ((sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
++ if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
+ errx(1, "couldn't initialize sending");
+
+- libnet_seed_prand();
++ libnet_seed_prand(l);
+
+ warnx("listening on %s [%s]", intf, filter);
+
+- pcap_loop(pd, -1, tcp_kill_cb, (u_char *)&sock);
++ pcap_loop(pd, -1, tcp_kill_cb, (u_char *)l);
+
+ /* NOTREACHED */
+
+--- a/tcpnice.c 2011-06-19 17:14:04.547999389 -0500
++++ b/tcpnice.c 2011-06-19 17:15:10.539999375 -0500
+@@ -41,107 +41,106 @@
+ }
+
+ static void
+-send_tcp_window_advertisement(int sock, struct libnet_ip_hdr *ip,
++send_tcp_window_advertisement(libnet_t *l, struct libnet_ipv4_hdr *ip,
+ struct libnet_tcp_hdr *tcp)
+ {
+ int len;
+
+ ip->ip_hl = 5;
+- ip->ip_len = htons(IP_H + TCP_H);
+- ip->ip_id = libnet_get_prand(PRu16);
+- memcpy(buf, (u_char *)ip, IP_H);
++ ip->ip_len = htons(LIBNET_IPV4_H + LIBNET_TCP_H);
++ ip->ip_id = libnet_get_prand(LIBNET_PRu16);
++ memcpy(buf, (u_char *)ip, LIBNET_IPV4_H);
+
+ tcp->th_off = 5;
+ tcp->th_win = htons(MIN_WIN);
+- memcpy(buf + IP_H, (u_char *)tcp, TCP_H);
++ memcpy(buf + LIBNET_IPV4_H, (u_char *)tcp, LIBNET_TCP_H);
+
+- libnet_do_checksum(buf, IPPROTO_TCP, TCP_H);
++ libnet_do_checksum(l, buf, IPPROTO_TCP, LIBNET_TCP_H);
+
+- len = IP_H + TCP_H;
++ len = LIBNET_IPV4_H + LIBNET_TCP_H;
+
+- if (libnet_write_ip(sock, buf, len) != len)
++ if (libnet_write_raw_ipv4(l, buf, len) != len)
+ warn("write");
+
+ fprintf(stderr, "%s:%d > %s:%d: . ack %lu win %d\n",
+- libnet_host_lookup(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
+- libnet_host_lookup(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
++ libnet_addr2name4(ip->ip_src.s_addr, 0), ntohs(tcp->th_sport),
++ libnet_addr2name4(ip->ip_dst.s_addr, 0), ntohs(tcp->th_dport),
+ ntohl(tcp->th_ack), 1);
+ }
+
+ static void
+-send_icmp_source_quench(int sock, struct libnet_ip_hdr *ip)
++send_icmp_source_quench(libnet_t *l, struct libnet_ipv4_hdr *ip)
+ {
+- struct libnet_icmp_hdr *icmp;
++ struct libnet_icmpv4_hdr *icmp;
+ int len;
+
+ len = (ip->ip_hl * 4) + 8;
+
+- libnet_build_ip(ICMP_ECHO_H + len, 0, libnet_get_prand(PRu16),
+- 0, 64, IPPROTO_ICMP, ip->ip_dst.s_addr,
+- ip->ip_src.s_addr, NULL, 0, buf);
+-
+- icmp = (struct libnet_icmp_hdr *)(buf + IP_H);
++ icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
+ icmp->icmp_type = ICMP_SOURCEQUENCH;
+ icmp->icmp_code = 0;
+- memcpy((u_char *)icmp + ICMP_ECHO_H, (u_char *)ip, len);
++ memcpy((u_char *)icmp + LIBNET_ICMPV4_ECHO_H, (u_char *)ip, len);
+
+- libnet_do_checksum(buf, IPPROTO_ICMP, ICMP_ECHO_H + len);
++ len += LIBNET_ICMPV4_ECHO_H;
+
+- len += (IP_H + ICMP_ECHO_H);
++ libnet_build_ipv4(LIBNET_IPV4_H + len, 0,
++ libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
++ 0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
++ (u_int8_t *) icmp, len, l, 0);
+
+- if (libnet_write_ip(sock, buf, len) != len)
++ if (libnet_write(l) != len)
+ warn("write");
+
+ fprintf(stderr, "%s > %s: icmp: source quench\n",
+- libnet_host_lookup(ip->ip_dst.s_addr, 0),
+- libnet_host_lookup(ip->ip_src.s_addr, 0));
++ libnet_addr2name4(ip->ip_dst.s_addr, 0),
++ libnet_addr2name4(ip->ip_src.s_addr, 0));
+ }
+
+ static void
+-send_icmp_frag_needed(int sock, struct libnet_ip_hdr *ip)
++send_icmp_frag_needed(libnet_t *l, struct libnet_ipv4_hdr *ip)
+ {
+- struct libnet_icmp_hdr *icmp;
++ struct libnet_icmpv4_hdr *icmp;
+ int len;
+
+ len = (ip->ip_hl * 4) + 8;
+
+- libnet_build_ip(ICMP_MASK_H + len, 4, libnet_get_prand(PRu16),
+- 0, 64, IPPROTO_ICMP, ip->ip_dst.s_addr,
+- ip->ip_src.s_addr, NULL, 0, buf);
+-
+- icmp = (struct libnet_icmp_hdr *)(buf + IP_H);
++ icmp = (struct libnet_icmpv4_hdr *)(buf + LIBNET_IPV4_H);
+ icmp->icmp_type = ICMP_UNREACH;
+ icmp->icmp_code = ICMP_UNREACH_NEEDFRAG;
+ icmp->hun.frag.pad = 0;
+ icmp->hun.frag.mtu = htons(MIN_MTU);
+- memcpy((u_char *)icmp + ICMP_MASK_H, (u_char *)ip, len);
++ memcpy((u_char *)icmp + LIBNET_ICMPV4_MASK_H, (u_char *)ip, len);
+
+- libnet_do_checksum(buf, IPPROTO_ICMP, ICMP_MASK_H + len);
+-
+- len += (IP_H + ICMP_MASK_H);
++ len += LIBNET_ICMPV4_MASK_H;
++
++ libnet_build_ipv4(LIBNET_IPV4_H + len, 4,
++ libnet_get_prand(LIBNET_PRu16), 0, 64, IPPROTO_ICMP,
++ 0, ip->ip_dst.s_addr, ip->ip_src.s_addr,
++ (u_int8_t *) icmp, len, l, 0);
+
+- if (libnet_write_ip(sock, buf, len) != len)
++ if (libnet_write(l) != len)
+ warn("write");
+
+ fprintf(stderr, "%s > %s: icmp: ",
+- libnet_host_lookup(ip->ip_dst.s_addr, 0),
+- libnet_host_lookup(ip->ip_src.s_addr, 0));
++ libnet_addr2name4(ip->ip_dst.s_addr, 0),
++ libnet_addr2name4(ip->ip_src.s_addr, 0));
+ fprintf(stderr, "%s unreachable - need to frag (mtu %d)\n",
+- libnet_host_lookup(ip->ip_src.s_addr, 0), MIN_MTU);
++ libnet_addr2name4(ip->ip_src.s_addr, 0), MIN_MTU);
+ }
+
+ static void
+ tcp_nice_cb(u_char *user, const struct pcap_pkthdr *pcap, const u_char *pkt)
+ {
+- struct libnet_ip_hdr *ip;
++ struct libnet_ipv4_hdr *ip;
+ struct libnet_tcp_hdr *tcp;
+- int *sock, len;
++ int len;
++ libnet_t *l;
+
+- sock = (int *)user;
++ l = (libnet_t *)user;
+ pkt += pcap_off;
+ len = pcap->caplen - pcap_off;
+
+- ip = (struct libnet_ip_hdr *)pkt;
++ ip = (struct libnet_ipv4_hdr *)pkt;
+ if (ip->ip_p != IPPROTO_TCP)
+ return;
+
+@@ -151,11 +150,11 @@
+
+ if (ntohs(ip->ip_len) > (ip->ip_hl << 2) + (tcp->th_off << 2)) {
+ if (Opt_icmp)
+- send_icmp_source_quench(*sock, ip);
++ send_icmp_source_quench(l, ip);
+ if (Opt_win)
+- send_tcp_window_advertisement(*sock, ip, tcp);
++ send_tcp_window_advertisement(l, ip, tcp);
+ if (Opt_pmtu)
+- send_icmp_frag_needed(*sock, ip);
++ send_icmp_frag_needed(l, ip);
+ }
+ }
+
+@@ -164,8 +163,10 @@
+ {
+ extern char *optarg;
+ extern int optind;
+- int c, sock;
++ int c;
+ char *intf, *filter, ebuf[PCAP_ERRBUF_SIZE];
++ char libnet_ebuf[LIBNET_ERRBUF_SIZE];
++ libnet_t *l;
+ pcap_t *pd;
+
+ intf = NULL;
+@@ -209,14 +210,14 @@
+ if ((pcap_off = pcap_dloff(pd)) < 0)
+ errx(1, "couldn't determine link layer offset");
+
+- if ((sock = libnet_open_raw_sock(IPPROTO_RAW)) == -1)
++ if ((l = libnet_init(LIBNET_RAW4, intf, libnet_ebuf)) == NULL)
+ errx(1, "couldn't initialize sending");
+
+- libnet_seed_prand();
++ libnet_seed_prand(l);
+
+ warnx("listening on %s [%s]", intf, filter);
+
+- pcap_loop(pd, -1, tcp_nice_cb, (u_char *)&sock);
++ pcap_loop(pd, -1, tcp_nice_cb, (u_char *)l);
+
+ /* NOTREACHED */
+
+--- a/tcp_raw.c 2011-06-19 17:14:06.375999389 -0500
++++ b/tcp_raw.c 2011-06-19 17:15:10.543999375 -0500
+@@ -119,7 +119,7 @@
+ }
+
+ struct iovec *
+-tcp_raw_input(struct libnet_ip_hdr *ip, struct libnet_tcp_hdr *tcp, int len)
++tcp_raw_input(struct libnet_ipv4_hdr *ip, struct libnet_tcp_hdr *tcp, int len)
+ {
+ struct tha tha;
+ struct tcp_conn *conn;
+@@ -131,7 +131,7 @@
+
+ /* Verify TCP checksum. */
+ cksum = tcp->th_sum;
+- libnet_do_checksum((u_char *) ip, IPPROTO_TCP, len);
++ libnet_do_checksum(NULL, (u_char *) ip, IPPROTO_TCP, len);
+
+ if (cksum != tcp->th_sum)
+ return (NULL);
+--- a/tcp_raw.h 2011-06-19 17:14:05.079999389 -0500
++++ b/tcp_raw.h 2011-06-19 17:15:10.547999375 -0500
+@@ -15,7 +15,7 @@
+ u_short sport, u_short dport,
+ u_char *buf, int len);
+
+-struct iovec *tcp_raw_input(struct libnet_ip_hdr *ip,
++struct iovec *tcp_raw_input(struct libnet_ipv4_hdr *ip,
+ struct libnet_tcp_hdr *tcp, int len);
+
+ void tcp_raw_timeout(int timeout, tcp_raw_callback_t callback);
+--- a/trigger.c 2011-06-19 17:14:05.483999389 -0500
++++ b/trigger.c 2011-06-19 17:15:10.551999375 -0500
+@@ -276,7 +276,7 @@
+ }
+
+ void
+-trigger_ip(struct libnet_ip_hdr *ip)
++trigger_ip(struct libnet_ipv4_hdr *ip)
+ {
+ struct trigger *t, tr;
+ u_char *buf;
+@@ -305,7 +305,7 @@
+
+ /* libnids needs a nids_register_udp()... */
+ void
+-trigger_udp(struct libnet_ip_hdr *ip)
++trigger_udp(struct libnet_ipv4_hdr *ip)
+ {
+ struct trigger *t, tr;
+ struct libnet_udp_hdr *udp;
+@@ -437,7 +437,7 @@
+ }
+
+ void
+-trigger_tcp_raw(struct libnet_ip_hdr *ip)
++trigger_tcp_raw(struct libnet_ipv4_hdr *ip)
+ {
+ struct trigger *t, tr;
+ struct libnet_tcp_hdr *tcp;
+--- a/trigger.h 2011-06-19 17:14:04.371999389 -0500
++++ b/trigger.h 2011-06-19 17:15:10.555999375 -0500
+@@ -24,10 +24,10 @@
+ int trigger_set_tcp(int port, char *name);
+ int trigger_set_rpc(int program, char *name);
+
+-void trigger_ip(struct libnet_ip_hdr *ip);
+-void trigger_udp(struct libnet_ip_hdr *ip);
++void trigger_ip(struct libnet_ipv4_hdr *ip);
++void trigger_udp(struct libnet_ipv4_hdr *ip);
+ void trigger_tcp(struct tcp_stream *ts, void **conn_save);
+-void trigger_tcp_raw(struct libnet_ip_hdr *ip);
++void trigger_tcp_raw(struct libnet_ipv4_hdr *ip);
+ void trigger_tcp_raw_timeout(int signal);
+ void trigger_rpc(int program, int proto, int port);
+
+--- a/urlsnarf.c 2011-06-19 17:15:08.631999375 -0500
++++ b/urlsnarf.c 2011-06-19 17:15:10.559999375 -0500
+@@ -145,14 +145,14 @@
+ if (user == NULL)
+ user = "-";
+ if (vhost == NULL)
+- vhost = libnet_host_lookup(addr->daddr, Opt_dns);
++ vhost = libnet_addr2name4(addr->daddr, Opt_dns);
+ if (referer == NULL)
+ referer = "-";
+ if (agent == NULL)
+ agent = "-";
+
+ printf("%s - %s [%s] \"%s http://%s%s\" - - \"%s\" \"%s\"\n",
+- libnet_host_lookup(addr->saddr, Opt_dns),
++ libnet_addr2name4(addr->saddr, Opt_dns),
+ user, timestamp(), req, vhost, uri, referer, agent);
+ }
+ fflush(stdout);
+--- a/webmitm.c 2011-06-19 17:14:07.231999387 -0500
++++ b/webmitm.c 2011-06-19 17:15:10.559999375 -0500
+@@ -242,7 +242,7 @@
+ word = buf_tok(&msg, "/", 1);
+ vhost = buf_strdup(word);
+ }
+- ssin.sin_addr.s_addr = libnet_name_resolve(vhost, 1);
++ ssin.sin_addr.s_addr = libnet_name2addr4(NULL, vhost, 1);
+ free(vhost);
+
+ if (ssin.sin_addr.s_addr == ntohl(INADDR_LOOPBACK) ||
+@@ -510,7 +510,7 @@
+ argv += optind;
+
+ if (argc == 1) {
+- if ((static_host = libnet_name_resolve(argv[0], 1)) == -1)
++ if ((static_host = libnet_name2addr4(NULL, argv[0], 1)) == -1)
+ usage();
+ }
+ else if (argc != 0) usage();
+--- a/webspy.c 2011-06-19 17:15:01.111999376 -0500
++++ b/webspy.c 2011-06-19 17:15:10.563999375 -0500
+@@ -126,7 +126,7 @@
+ if (auth == NULL)
+ auth = "";
+ if (vhost == NULL)
+- vhost = libnet_host_lookup(addr->daddr, 0);
++ vhost = libnet_addr2name4(addr->daddr, 0);
+
+ snprintf(cmd, sizeof(cmd), "openURL(http://%s%s%s%s)",
+ auth, *auth ? "@" : "", vhost, uri);
+@@ -205,7 +205,7 @@
+ cmdtab[0] = cmd;
+ cmdtab[1] = NULL;
+
+- if ((host = libnet_name_resolve(argv[0], 1)) == -1)
++ if ((host = libnet_name2addr4(NULL, argv[0], 1)) == -1)
+ errx(1, "unknown host");
+
+ if ((dpy = XOpenDisplay(NULL)) == NULL)
diff --git a/testing/dsniff/08_checksum.patch b/testing/dsniff/08_checksum.patch
new file mode 100644
index 0000000000..44ece65f61
--- /dev/null
+++ b/testing/dsniff/08_checksum.patch
@@ -0,0 +1,25 @@
+Author: Piotr Engelking <inkerman42@gmail.com>
+Description: Disable the filtering packets with incorrect checksum (Closes: #372536).
+--- a/urlsnarf.c 2011-06-19 17:15:10.559999375 -0500
++++ b/urlsnarf.c 2011-06-19 17:15:18.023999373 -0500
+@@ -200,6 +200,7 @@
+ extern char *optarg;
+ extern int optind;
+ int c;
++ struct nids_chksum_ctl chksum_ctl;
+
+ while ((c = getopt(argc, argv, "i:p:nvh?V")) != -1) {
+ switch (c) {
+@@ -260,6 +261,12 @@
+ }
+ }
+
++ chksum_ctl.netaddr = 0;
++ chksum_ctl.mask = 0;
++ chksum_ctl.action = NIDS_DONT_CHKSUM;
++
++ nids_register_chksum_ctl(&chksum_ctl, 1);
++
+ nids_run();
+
+ /* NOTREACHED */
diff --git a/testing/dsniff/08_openssl-0.9.8.patch b/testing/dsniff/08_openssl-0.9.8.patch
new file mode 100644
index 0000000000..f5f6cacd22
--- /dev/null
+++ b/testing/dsniff/08_openssl-0.9.8.patch
@@ -0,0 +1,12 @@
+Author: <kees@ubuntu.com>
+Description: Fix FTBFS with openssl.
+--- a/ssh.c 2011-06-19 17:14:01.359999389 -0500
++++ b/ssh.c 2011-06-19 17:15:14.343999374 -0500
+@@ -16,6 +16,7 @@
+ #include <openssl/ssl.h>
+ #include <openssl/err.h>
+ #include <openssl/rand.h>
++#include <openssl/md5.h>
+
+ #include <err.h>
+ #include <errno.h>
diff --git a/testing/dsniff/09_sshcrypto.patch b/testing/dsniff/09_sshcrypto.patch
new file mode 100644
index 0000000000..f229c6cd2f
--- /dev/null
+++ b/testing/dsniff/09_sshcrypto.patch
@@ -0,0 +1,14 @@
+Author: Steve Kemp <skx@debian.org>
+Description: Missing openssl includes in sshcrypto.c.
+This patch was through diff.gz and now is implemented as a dpatch.
+--- a/sshcrypto.c 2011-06-19 17:13:57.971999389 -0500
++++ b/sshcrypto.c 2011-06-19 17:15:19.847999373 -0500
+@@ -14,6 +14,8 @@
+
+ #include <sys/types.h>
+ #include <openssl/ssl.h>
++#include <openssl/blowfish.h>
++#include <openssl/des.h>
+
+ #include <err.h>
+ #include <stdio.h>
diff --git a/testing/dsniff/09_sysconf_clocks.patch b/testing/dsniff/09_sysconf_clocks.patch
new file mode 100644
index 0000000000..54ba96dabd
--- /dev/null
+++ b/testing/dsniff/09_sysconf_clocks.patch
@@ -0,0 +1,20 @@
+Author: <kees@ubuntu.com>
+Description: Fix FTBFS: ./sshow.c:226: error: 'CLK_TCK' undeclared.
+--- a/sshow.c 2011-06-19 17:15:01.099999376 -0500
++++ b/sshow.c 2011-06-19 17:15:16.175999374 -0500
+@@ -217,6 +217,7 @@
+ {
+ clock_t delay;
+ int payload;
++ long CLK_TCK= sysconf(_SC_CLK_TCK);
+
+ delay = add_history(session, 0, cipher_size, plain_range);
+
+@@ -265,6 +266,7 @@
+ clock_t delay;
+ int skip;
+ range string_range;
++ long CLK_TCK= sysconf(_SC_CLK_TCK);
+
+ delay = add_history(session, 1, cipher_size, plain_range);
+
diff --git a/testing/dsniff/10_urlsnarf_escape.patch b/testing/dsniff/10_urlsnarf_escape.patch
new file mode 100644
index 0000000000..c1aad38cba
--- /dev/null
+++ b/testing/dsniff/10_urlsnarf_escape.patch
@@ -0,0 +1,85 @@
+Author: Hilko Bengen <bengen@debian.org>
+Description: Escape user, vhost, uri, referer, agent strings in log (Closes: #372536).
+--- a/urlsnarf.c 2011-06-19 17:15:18.023999373 -0500
++++ b/urlsnarf.c 2011-06-19 17:15:21.627999373 -0500
+@@ -84,6 +84,43 @@
+ return (tstr);
+ }
+
++static char *
++escape_log_entry(char *string)
++{
++ char *out;
++ unsigned char *c, *o;
++ size_t len;
++
++ if (!string)
++ return NULL;
++
++ /* Determine needed length */
++ for (c = string, len = 0; *c; c++) {
++ if ((*c < 32) || (*c >= 128))
++ len += 4;
++ else if ((*c == '"') || (*c =='\\'))
++ len += 2;
++ else
++ len++;
++ }
++ out = malloc(len+1);
++ if (!out)
++ return NULL;
++ for (c = string, o = out; *c; c++, o++) {
++ if ((*c < 32) || (*c >= 128)) {
++ snprintf(o, 5, "\\x%02x", *c);
++ o += 3;
++ } else if ((*c == '"') || ((*c =='\\'))) {
++ *(o++) = '\\';
++ *o = *c;
++ } else {
++ *o = *c;
++ }
++ }
++ out[len]='\0';
++ return out;
++}
++
+ static int
+ process_http_request(struct tuple4 *addr, u_char *data, int len)
+ {
+@@ -142,18 +179,26 @@
+ buf_tok(NULL, NULL, i);
+ }
+ }
+- if (user == NULL)
+- user = "-";
+- if (vhost == NULL)
+- vhost = libnet_addr2name4(addr->daddr, Opt_dns);
+- if (referer == NULL)
+- referer = "-";
+- if (agent == NULL)
+- agent = "-";
+-
++ user = escape_log_entry(user);
++ vhost = escape_log_entry(vhost);
++ uri = escape_log_entry(uri);
++ referer = escape_log_entry(referer);
++ agent = escape_log_entry(agent);
++
+ printf("%s - %s [%s] \"%s http://%s%s\" - - \"%s\" \"%s\"\n",
+ libnet_addr2name4(addr->saddr, Opt_dns),
+- user, timestamp(), req, vhost, uri, referer, agent);
++ (user?user:"-"),
++ timestamp(), req,
++ (vhost?vhost:libnet_addr2name4(addr->daddr, Opt_dns)),
++ uri,
++ (referer?referer:"-"),
++ (agent?agent:"-"));
++
++ free(user);
++ free(vhost);
++ free(uri);
++ free(referer);
++ free(agent);
+ }
+ fflush(stdout);
+
diff --git a/testing/dsniff/11_string_header.patch b/testing/dsniff/11_string_header.patch
new file mode 100644
index 0000000000..2b6a7393ff
--- /dev/null
+++ b/testing/dsniff/11_string_header.patch
@@ -0,0 +1,163 @@
+Author: Luciano Bello <luciano@linux.org.ar>
+Description: Aviod the "implicit declaration of function 'str*'" warning
+--- a/arp.c 2011-06-19 17:15:04.587999376 -0500
++++ b/arp.c 2011-06-19 17:15:23.487999372 -0500
+@@ -34,6 +34,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <string.h>
+
+ #include "arp.h"
+
+--- a/buf.c 2011-06-19 17:13:56.463999389 -0500
++++ b/buf.c 2011-06-19 17:15:23.487999372 -0500
+@@ -17,6 +17,7 @@
+ #include <unistd.h>
+ #include <ctype.h>
+ #include <err.h>
++#include <string.h>
+
+ #include "buf.h"
+
+--- a/decode_nntp.c 2011-06-19 17:13:53.631999390 -0500
++++ b/decode_nntp.c 2011-06-19 17:15:23.491999372 -0500
+@@ -15,6 +15,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
+
+ #include "base64.h"
+ #include "decode.h"
+--- a/decode_pop.c 2011-06-19 17:13:54.911999390 -0500
++++ b/decode_pop.c 2011-06-19 17:15:23.495999372 -0500
+@@ -14,6 +14,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
+
+ #include "base64.h"
+ #include "options.h"
+--- a/decode_rlogin.c 2011-06-19 17:13:54.431999390 -0500
++++ b/decode_rlogin.c 2011-06-19 17:15:23.495999372 -0500
+@@ -14,6 +14,8 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcpy.h>
++#include <strlcat.h>
+
+ #include "options.h"
+ #include "decode.h"
+--- a/decode_smb.c 2011-06-19 17:13:55.103999390 -0500
++++ b/decode_smb.c 2011-06-19 17:15:23.499999372 -0500
+@@ -15,6 +15,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
+
+ #include "decode.h"
+
+--- a/decode_smtp.c 2011-06-19 17:13:54.003999391 -0500
++++ b/decode_smtp.c 2011-06-19 17:15:23.503999372 -0500
+@@ -14,6 +14,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
+
+ #include "base64.h"
+ #include "options.h"
+--- a/decode_sniffer.c 2011-06-19 17:13:56.075999390 -0500
++++ b/decode_sniffer.c 2011-06-19 17:15:23.503999372 -0500
+@@ -15,6 +15,8 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
++#include <strlcpy.h>
+
+ #include "base64.h"
+ #include "decode.h"
+--- a/decode_socks.c 2011-06-19 17:13:55.271999391 -0500
++++ b/decode_socks.c 2011-06-19 17:15:23.507999372 -0500
+@@ -14,6 +14,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
+
+ #include "decode.h"
+
+--- a/decode_tds.c 2011-06-19 17:13:55.899999390 -0500
++++ b/decode_tds.c 2011-06-19 17:15:23.511999372 -0500
+@@ -18,6 +18,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
+
+ #include "decode.h"
+
+--- a/decode_telnet.c 2011-06-19 17:13:55.491999391 -0500
++++ b/decode_telnet.c 2011-06-19 17:15:23.515999372 -0500
+@@ -14,6 +14,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcpy.h>
+
+ #include "options.h"
+ #include "decode.h"
+--- a/decode_x11.c 2011-06-19 17:13:53.823999390 -0500
++++ b/decode_x11.c 2011-06-19 17:15:23.515999372 -0500
+@@ -14,6 +14,8 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <strlcat.h>
++#include <strlcpy.h>
+
+ #include "decode.h"
+
+--- a/dnsspoof.c 2011-06-19 17:15:10.515999375 -0500
++++ b/dnsspoof.c 2011-06-19 17:15:23.519999372 -0500
+@@ -20,6 +20,7 @@
+ #include <stdlib.h>
+ #include <signal.h>
+ #include <string.h>
++#include <strlcpy.h>
+ #include <resolv.h>
+ #include <err.h>
+ #include <libnet.h>
+--- a/magic.c 2011-06-19 17:13:55.703999390 -0500
++++ b/magic.c 2011-06-19 17:15:23.523999372 -0500
+@@ -36,6 +36,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <strlcpy.h>
+ #include <ctype.h>
+ #include <time.h>
+ #include <err.h>
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ b/missing/strlcat.h 2011-06-19 17:15:23.527999372 -0500
+@@ -0,0 +1 @@
++size_t strlcat(char *dst, const char *src, size_t siz);
+--- /dev/null 1970-01-01 00:00:00.000000000 +0000
++++ b/missing/strlcpy.h 2011-06-19 17:15:23.531999372 -0500
+@@ -0,0 +1 @@
++size_t strlcpy(char *dst, const char *src, size_t siz);
+--- a/sshmitm.c 2011-06-19 17:15:10.527999375 -0500
++++ b/sshmitm.c 2011-06-19 17:15:23.531999372 -0500
+@@ -24,6 +24,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <unistd.h>
++#include <strlcat.h>
+
+ #include "buf.h"
+ #include "record.h"
diff --git a/testing/dsniff/12_arpa_inet_header.patch b/testing/dsniff/12_arpa_inet_header.patch
new file mode 100644
index 0000000000..3ce041f86f
--- /dev/null
+++ b/testing/dsniff/12_arpa_inet_header.patch
@@ -0,0 +1,62 @@
+Author: Luciano Bello <luciano@linux.org.ar>
+Description: aviod the "implicit declaration of function 'ntohs'" warning
+--- a/decode_aim.c 2011-06-19 17:13:50.503999391 -0500
++++ b/decode_aim.c 2011-06-19 17:15:27.267999371 -0500
+@@ -14,6 +14,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <arpa/inet.h>
+
+ #include "hex.h"
+ #include "buf.h"
+--- a/decode_mmxp.c 2011-06-19 17:13:50.323999391 -0500
++++ b/decode_mmxp.c 2011-06-19 17:15:27.271999371 -0500
+@@ -21,6 +21,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <arpa/inet.h>
+
+ #include "buf.h"
+ #include "decode.h"
+--- a/decode_pptp.c 2011-06-19 17:13:50.687999391 -0500
++++ b/decode_pptp.c 2011-06-19 17:15:27.275999371 -0500
+@@ -16,6 +16,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <arpa/inet.h>
+
+ #include "buf.h"
+ #include "decode.h"
+--- a/decode_tds.c 2011-06-19 17:15:23.511999372 -0500
++++ b/decode_tds.c 2011-06-19 17:15:27.275999371 -0500
+@@ -19,6 +19,7 @@
+ #include <stdio.h>
+ #include <string.h>
+ #include <strlcat.h>
++#include <arpa/inet.h>
+
+ #include "decode.h"
+
+--- a/decode_vrrp.c 2011-06-19 17:13:51.243999390 -0500
++++ b/decode_vrrp.c 2011-06-19 17:15:27.287999371 -0500
+@@ -15,6 +15,7 @@
+
+ #include <stdio.h>
+ #include <string.h>
++#include <arpa/inet.h>
+
+ #include "buf.h"
+ #include "decode.h"
+--- a/ssh.c 2011-06-19 17:15:14.343999374 -0500
++++ b/ssh.c 2011-06-19 17:15:27.291999371 -0500
+@@ -23,6 +23,7 @@
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
++#include <arpa/inet.h>
+ #include <unistd.h>
+
+ #include "hex.h"
diff --git a/testing/dsniff/13_pop_with_version.patch b/testing/dsniff/13_pop_with_version.patch
new file mode 100644
index 0000000000..7c16cd12bb
--- /dev/null
+++ b/testing/dsniff/13_pop_with_version.patch
@@ -0,0 +1,27 @@
+Author: Luciano Bello <luciano@linux.org.ar>
+Description: distinguish between pop versions
+--- a/decode.c 2011-06-19 17:13:48.679999392 -0500
++++ b/decode.c 2011-06-19 17:15:29.771999369 -0500
+@@ -63,7 +63,8 @@
+ { "http", decode_http },
+ { "ospf", decode_ospf },
+ { "poppass", decode_poppass },
+- { "pop", decode_pop },
++ { "pop2", decode_pop },
++ { "pop3", decode_pop },
+ { "nntp", decode_nntp },
+ { "smb", decode_smb },
+ { "imap", decode_imap },
+--- a/dsniff.services 2011-06-19 17:13:48.883999392 -0500
++++ b/dsniff.services 2011-06-19 17:15:29.799999369 -0500
+@@ -10,8 +10,8 @@
+ ospf 89/ip
+ http 98/tcp
+ poppass 106/tcp
+-pop 109/tcp
+-pop 110/tcp
++pop2 109/tcp
++pop3 110/tcp
+ portmap 111/tcp
+ portmap -111/tcp
+ portmap 111/udp
diff --git a/testing/dsniff/14_obsolete_time.patch b/testing/dsniff/14_obsolete_time.patch
new file mode 100644
index 0000000000..a1a787f3f3
--- /dev/null
+++ b/testing/dsniff/14_obsolete_time.patch
@@ -0,0 +1,33 @@
+Author: Luciano Bello <luciano@linux.org.ar>
+Description: According to /usr/include/time.h, CLK_TCK is the
+"obsolete POSIX.1-1988 name" for CLOCKS_PER_SEC.
+Closes #420944
+--- a/sshow.c 2011-06-19 17:15:16.175999374 -0500
++++ b/sshow.c 2011-06-19 17:15:31.875999369 -0500
+@@ -224,7 +224,7 @@
+ if (debug)
+ printf("- %s -> %s: DATA (%s bytes, %.2f seconds)\n",
+ s_saddr(ts), s_daddr(ts), s_range(plain_range),
+- (float)delay / CLK_TCK);
++ (float)delay / CLOCKS_PER_SEC);
+ if (debug > 1)
+ print_data(&ts->server, cipher_size);
+
+@@ -273,7 +273,7 @@
+ if (debug)
+ printf("- %s <- %s: DATA (%s bytes, %.2f seconds)\n",
+ s_saddr(ts), s_daddr(ts), s_range(plain_range),
+- (float)delay / CLK_TCK);
++ (float)delay / CLOCKS_PER_SEC);
+ if (debug > 1)
+ print_data(&ts->client, cipher_size);
+
+@@ -302,7 +302,7 @@
+
+ if (session->state == 1 &&
+ #ifdef USE_TIMING
+- now - get_history(session, 2)->timestamp >= CLK_TCK &&
++ now - get_history(session, 2)->timestamp >= CLOCKS_PER_SEC &&
+ #endif
+ session->protocol == 1 &&
+ (session->history.directions & 7) == 5 &&
diff --git a/testing/dsniff/15_checksum_libnids.patch b/testing/dsniff/15_checksum_libnids.patch
new file mode 100644
index 0000000000..adaa67c9f0
--- /dev/null
+++ b/testing/dsniff/15_checksum_libnids.patch
@@ -0,0 +1,94 @@
+Author: Gleb Paharenko <gpaharenko@gmail.com>
+Description: Workaround to #420129.
+--- a/dsniff.c 2011-06-19 17:15:01.071999376 -0500
++++ b/dsniff.c 2011-06-19 17:15:33.707999369 -0500
+@@ -70,6 +70,80 @@
+ {
+ }
+
++
++static int get_all_ifaces(struct ifreq **, int *);
++static unsigned int get_addr_from_ifreq(struct ifreq *);
++
++int all_local_ipaddrs_chksum_disable()
++{
++ struct ifreq *ifaces;
++ int ifaces_count;
++ int i, ind = 0;
++ struct nids_chksum_ctl *ctlp;
++ unsigned int tmp;
++
++ if (!get_all_ifaces(&ifaces, &ifaces_count))
++ return -1;
++ ctlp =
++ (struct nids_chksum_ctl *) malloc(ifaces_count *
++ sizeof(struct
++ nids_chksum_ctl));
++ if (!ctlp)
++ return -1;
++ for (i = 0; i < ifaces_count; i++) {
++ tmp = get_addr_from_ifreq(ifaces + i);
++ if (tmp) {
++ ctlp[ind].netaddr = tmp;
++ ctlp[ind].mask = inet_addr("255.255.255.255");
++ ctlp[ind].action = NIDS_DONT_CHKSUM;
++ ind++;
++ }
++ }
++ free(ifaces);
++ nids_register_chksum_ctl(ctlp, ind);
++}
++
++/* helper functions for Example 2 */
++unsigned int get_addr_from_ifreq(struct ifreq *iface)
++{
++ if (iface->ifr_addr.sa_family == AF_INET)
++ return ((struct sockaddr_in *) &(iface->ifr_addr))->
++ sin_addr.s_addr;
++ return 0;
++}
++
++static int get_all_ifaces(struct ifreq **ifaces, int *count)
++{
++ int ifaces_size = 8 * sizeof(struct ifreq);
++ struct ifconf param;
++ int sock;
++ unsigned int i;
++
++ *ifaces = malloc(ifaces_size);
++ sock = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
++ if (sock <= 0)
++ return 0;
++ for (;;) {
++ param.ifc_len = ifaces_size;
++ param.ifc_req = *ifaces;
++ if (ioctl(sock, SIOCGIFCONF, &param))
++ goto err;
++ if (param.ifc_len < ifaces_size)
++ break;
++ free(*ifaces);
++ ifaces_size *= 2;
++ ifaces = malloc(ifaces_size);
++ }
++ *count = param.ifc_len / sizeof(struct ifreq);
++ close(sock);
++ return 1;
++ err:
++ close(sock);
++ return 0;
++}
++
++
++
+ int
+ main(int argc, char *argv[])
+ {
+@@ -189,6 +263,8 @@
+ warnx("using %s", nids_params.filename);
+ }
+ }
++
++ all_local_ipaddrs_chksum_disable();
+
+ nids_run();
+
diff --git a/testing/dsniff/16_TDS_decoder.patch b/testing/dsniff/16_TDS_decoder.patch
new file mode 100644
index 0000000000..4bca9355a3
--- /dev/null
+++ b/testing/dsniff/16_TDS_decoder.patch
@@ -0,0 +1,16 @@
+Author: Luciano Bello <luciano@debian.org>
+Description: Patch provided by Hilko Bengen. #609988.
+--- a/decode_tds.c
++++ b/decode_tds.c
+@@ -144,6 +144,11 @@
+ len > sizeof(*th) && len >= ntohs(th->size);
+ buf += ntohs(th->size), len -= ntohs(th->size)) {
+
++ if (th->size != 8) {
++ /* wrong header length */
++ break;
++ }
++
+ if (th->type == 2) {
+ /* Version 4.x, 5.0 */
+ if (len < sizeof(*th) + sizeof(*tl))
diff --git a/testing/dsniff/20_debian_dirs.patch b/testing/dsniff/20_debian_dirs.patch
new file mode 100644
index 0000000000..05f55b83d2
--- /dev/null
+++ b/testing/dsniff/20_debian_dirs.patch
@@ -0,0 +1,59 @@
+Author: Steve Kemp <skx@debian.org>
+Description: Adapt to Debian directory structure.
+--- a/Makefile.in 2011-06-19 17:13:45.651999392 -0500
++++ b/Makefile.in 2011-06-19 17:15:37.407999368 -0500
+@@ -11,7 +11,7 @@
+ install_prefix =
+ prefix = @prefix@
+ exec_prefix = @exec_prefix@
+-libdir = @libdir@
++libdir = $(prefix)/share/dsniff
+ sbindir = @sbindir@
+ mandir = @mandir@
+
+@@ -37,8 +37,7 @@
+ X11INC = @X_CFLAGS@
+ X11LIB = @X_LIBS@ @X_PRE_LIBS@ -lXmu -lX11 @X_EXTRA_LIBS@
+
+-INCS = -I. $(NIDSINC) $(PCAPINC) $(LNETINC) $(DBINC) $(SSLINC) $(X11INC) \
+- -I$(srcdir)/missing
++INCS = -I. $(X11INC) -I$(srcdir)/missing
+ LIBS = @LIBS@ -L$(srcdir) -lmissing
+
+ INSTALL = @INSTALL@
+--- a/dnsspoof.8 2011-06-19 17:13:46.019999392 -0500
++++ b/dnsspoof.8 2011-06-19 17:15:37.423999369 -0500
+@@ -31,7 +31,7 @@
+ address queries on the LAN with an answer of the local machine's IP
+ address.
+ .SH FILES
+-.IP \fI/usr/local/lib/dnsspoof.hosts\fR
++.IP \fI/usr/share/dsniff/dnsspoof.hosts\fR
+ Sample hosts file.
+ .SH "SEE ALSO"
+ dsniff(8), hosts(5)
+--- a/dsniff.8 2011-06-19 17:15:01.067999376 -0500
++++ b/dsniff.8 2011-06-19 17:15:37.427999369 -0500
+@@ -68,9 +68,9 @@
+ On a hangup signal \fBdsniff\fR will dump its current trigger table to
+ \fIdsniff.services\fR.
+ .SH FILES
+-.IP \fI/usr/local/lib/dsniff.services\fR
++.IP \fI/usr/share/dsniff/dsniff.services\fR
+ Default trigger table
+-.IP \fI/usr/local/lib/dsniff.magic\fR
++.IP \fI/usr/share/dsniff/dsniff.magic\fR
+ Network protocol magic
+ .SH "SEE ALSO"
+ arpspoof(8), libnids(3), services(5), magic(5)
+--- a/pathnames.h 2011-06-19 17:13:46.219999392 -0500
++++ b/pathnames.h 2011-06-19 17:15:37.431999369 -0500
+@@ -12,7 +12,7 @@
+ #define PATHNAMES_H
+
+ #ifndef DSNIFF_LIBDIR
+-#define DSNIFF_LIBDIR "/usr/local/lib/"
++#define DSNIFF_LIBDIR "/usr/share/dsniff/"
+ #endif
+
+ #define DSNIFF_SERVICES "dsniff.services"
diff --git a/testing/dsniff/21_msgsnarf_segfault.patch b/testing/dsniff/21_msgsnarf_segfault.patch
new file mode 100644
index 0000000000..9df3f99927
--- /dev/null
+++ b/testing/dsniff/21_msgsnarf_segfault.patch
@@ -0,0 +1,12 @@
+Author: <bdefreese@debian2.bddebian.com>
+Description: Correctly 0 out the c struct.
+--- a/msgsnarf.c 2011-06-19 17:15:01.091999376 -0500
++++ b/msgsnarf.c 2011-06-19 17:15:39.739999369 -0500
+@@ -584,6 +584,7 @@
+ if (i == 0) {
+ if ((c = malloc(sizeof(*c))) == NULL)
+ nids_params.no_mem("sniff_msgs");
++ memset(c, 0, sizeof(*c));
+ c->ip = ts->addr.saddr;
+ c->nick = strdup("unknown");
+ SLIST_INSERT_HEAD(&client_list, c, next);
diff --git a/testing/dsniff/22_handlepp.patch b/testing/dsniff/22_handlepp.patch
new file mode 100644
index 0000000000..e4a4d22218
--- /dev/null
+++ b/testing/dsniff/22_handlepp.patch
@@ -0,0 +1,14 @@
+Author: Joerg Dorchain <joerg@dorchain.net>
+Description: Add tcpkill support for handle ppp interfaces.
+--- a/pcaputil.c 2011-06-19 17:13:44.419999392 -0500
++++ b/pcaputil.c 2011-06-19 17:15:41.607999368 -0500
+@@ -52,6 +52,9 @@
+ case DLT_NULL:
+ offset = 4;
+ break;
++ case DLT_LINUX_SLL: /* e.g. ppp */
++ offset = 16;
++ break;
+ default:
+ warnx("unsupported datalink type");
+ break;
diff --git a/testing/dsniff/23_urlsnarf_timestamp.patch b/testing/dsniff/23_urlsnarf_timestamp.patch
new file mode 100644
index 0000000000..f259efe1e3
--- /dev/null
+++ b/testing/dsniff/23_urlsnarf_timestamp.patch
@@ -0,0 +1,78 @@
+Author: Hilko Bengen <bengen@debian.org>
+Description: urlsnarf: use timestamps from pcap file if available. Closes: #573365
+--- a/urlsnarf.c 2011-06-19 17:15:21.627999373 -0500
++++ b/urlsnarf.c 2011-06-19 17:15:43.411999368 -0500
+@@ -36,6 +36,7 @@
+ u_short Opt_dns = 1;
+ int Opt_invert = 0;
+ regex_t *pregex = NULL;
++time_t tt = 0;
+
+ static void
+ usage(void)
+@@ -57,9 +58,12 @@ timestamp(void)
+ {
+ static char tstr[32], sign;
+ struct tm *t, gmt;
+- time_t tt = time(NULL);
+ int days, hours, tz, len;
+
++ if (!nids_params.filename) {
++ tt = time(NULL);
++ }
++
+ gmt = *gmtime(&tt);
+ t = localtime(&tt);
+
+@@ -312,9 +316,48 @@ main(int argc, char *argv[])
+
+ nids_register_chksum_ctl(&chksum_ctl, 1);
+
+- nids_run();
+-
+- /* NOTREACHED */
++ pcap_t *p;
++ char pcap_errbuf[PCAP_ERRBUF_SIZE];
++ if (nids_params.filename == NULL) {
++ /* adapted from libnids.c:open_live() */
++ if (strcmp(nids_params.device, "all") == 0)
++ nids_params.device = "any";
++ p = pcap_open_live(nids_params.device, 16384,
++ (nids_params.promisc != 0),
++ 0, pcap_errbuf);
++ if (!p) {
++ fprintf(stderr, "pcap_open_live(): %s\n",
++ pcap_errbuf);
++ exit(1);
++ }
++ }
++ else {
++ p = pcap_open_offline(nids_params.filename,
++ pcap_errbuf);
++ if (!p) {
++ fprintf(stderr, "pcap_open_offline(%s): %s\n",
++ nids_params.filename, pcap_errbuf);
++ }
++ }
++
++ struct pcap_pkthdr *h;
++ u_char *d;
++ int rc;
++ while ((rc = pcap_next_ex(p, &h, &d)) == 1) {
++ tt = h->ts.tv_sec;
++ nids_pcap_handler(NULL, h, d);
++ }
++ switch (rc) {
++ case(-2): /* end of pcap file */
++ case(0): /* timeout on live capture */
++ break;
++ case(-1):
++ default:
++ fprintf(stderr, "rc = %i\n", rc);
++ pcap_perror(p, "pcap_read_ex()");
++ exit(1);
++ break;
++ }
+
+ exit(0);
+ }
diff --git a/testing/dsniff/APKBUILD b/testing/dsniff/APKBUILD
new file mode 100644
index 0000000000..73d2da8cdc
--- /dev/null
+++ b/testing/dsniff/APKBUILD
@@ -0,0 +1,166 @@
+# Contributor: Francesco Colista <fcolista@alpinelinux.org>
+# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
+pkgname=dsniff
+pkgver=2.4b1
+pkgrel=0
+pkgdesc="dsniff is a collection of tools for network auditing and penetration testing"
+url="http://www.monkey.org/~dugsong/dsniff/"
+arch="all"
+license="BSD"
+depends=""
+depends_dev="openssl-dev libpcap-dev libxmu-dev libnet-dev \
+ glib-dev db-dev libnids-dev bsd-compat-headers libtirpc-dev \
+ linux-headers portablexdr-dev"
+makedepends="$depends_dev"
+install=""
+subpackages="$pkgname-doc"
+source="http://www.monkey.org/~dugsong/$pkgname/beta/$pkgname-$pkgver.tar.gz
+ 0001-rewrite-and-modernize-POP-decoder.patch
+ 01_time.h.patch
+ 02_mailsnarf_corrupt.patch
+ 03_pcap_read_dump.patch
+ 04_multiple_intf.patch
+ 05_amd64_fix.patch
+ 06_urlsnarf_zeropad.patch
+ 07_libnet_1.1.patch
+ 08_checksum.patch
+ 08_openssl-0.9.8.patch
+ 09_sshcrypto.patch
+ 09_sysconf_clocks.patch
+ 10_urlsnarf_escape.patch
+ 11_string_header.patch
+ 12_arpa_inet_header.patch
+ 13_pop_with_version.patch
+ 14_obsolete_time.patch
+ 15_checksum_libnids.patch
+ 16_TDS_decoder.patch
+ 20_debian_dirs.patch
+ 21_msgsnarf_segfault.patch
+ 22_handlepp.patch
+ 23_urlsnarf_timestamp.patch
+ dsniff-rpc.patch
+ dsniff-xcompile.patch
+ 0001-arpspoof-add-r-switch-to-poison-both-directions.patch
+ 0002-arpspoof-allow-use-of-of-multiple-targets.patch
+ 0003-arpspoof-allow-selection-of-source-hw-address.patch
+ 0004-arpspoof-mac-include.patch"
+
+_builddir=$srcdir/$pkgname-2.4
+
+prepare() {
+ local i
+ cd "$_builddir"
+ for i in $source; do
+ case $i in
+ *.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
+ esac
+ done
+}
+
+build() {
+ cd "$_builddir"
+ LDFLAGS="-lresolv -lglib-2.0 -lgthread-2.0 -lportablexdr $LDFLAGS" \
+ ./configure \
+ --prefix="/usr" \
+ --mandir=/usr/share
+ make -j1
+}
+
+package() {
+ cd "$_builddir"
+ make install_prefix="$pkgdir" install
+ install -D -m0644 LICENSE "$pkgdir"/usr/share/licenses/${pkgname}/LICENSE
+ install -d "$pkgdir"/usr/share
+ #mv "$pkgdir"/usr/man "$pkgdir"/usr/share/
+}
+
+md5sums="2f761fa3475682a7512b0b43568ee7d6 dsniff-2.4b1.tar.gz
+91d36e7747dec8d2fb6ed895aa830412 0001-rewrite-and-modernize-POP-decoder.patch
+27831926f40cb98d4b3adaaf90bbc6c6 01_time.h.patch
+b4b8aecb3eea7fd3bd0ae162fea4c0a1 02_mailsnarf_corrupt.patch
+7f91d8f8d4cf0075e8ffeb094e081610 03_pcap_read_dump.patch
+968888514c5c2a9af987f4cceb4ac9fa 04_multiple_intf.patch
+ce96f87fda1e59aef78fb485bcea79c6 05_amd64_fix.patch
+a4d552b87f446bfc3bde8d2e9578f20a 06_urlsnarf_zeropad.patch
+92f6fada68fe740bd487a6fc70169bdb 07_libnet_1.1.patch
+dc940de59dac1481adb3526ae4cdd732 08_checksum.patch
+4945f60a05838c2fd8168070e29ee111 08_openssl-0.9.8.patch
+584d08f4388ec72fc6f47a0ed02d7932 09_sshcrypto.patch
+12934d619adbdb2a0a9ef7009aa81950 09_sysconf_clocks.patch
+858ae43484d72a529be8e5b8dc6062fe 10_urlsnarf_escape.patch
+5d3ef271543bb552e46c3f7c1b3be258 11_string_header.patch
+4007bb7add77f089de501c4b466e4f1c 12_arpa_inet_header.patch
+9c10e5e6feb270e23590cf65f2996d5f 13_pop_with_version.patch
+6cd321083dbf87b2f12bc598c961c0e5 14_obsolete_time.patch
+3d1a71e25672923f7a2c515d500e974d 15_checksum_libnids.patch
+90b24d2ac3c6280304dc5ed419c6b492 16_TDS_decoder.patch
+e5ce452fef42833108b79aef1ea8b02c 20_debian_dirs.patch
+88dbf13a3741de475b25bd7b25fd13a5 21_msgsnarf_segfault.patch
+79e77c84b9a5316daf5c5c282ad4a375 22_handlepp.patch
+642e3447330d21dea5fa69cef17da64b 23_urlsnarf_timestamp.patch
+8b333c8092738cc436f9eb3d1461087f dsniff-rpc.patch
+1c6765668641905dd62bfb25c7997aa5 dsniff-xcompile.patch
+fbc9a39ef2e888e62cdc5b7a0b4ad55a 0001-arpspoof-add-r-switch-to-poison-both-directions.patch
+2f537f89ae9262925118b3ec3282ffe2 0002-arpspoof-allow-use-of-of-multiple-targets.patch
+24b0e3add6ab4940aa49de3fb6743066 0003-arpspoof-allow-selection-of-source-hw-address.patch
+85d9f0065dc1c738da6498b56866f719 0004-arpspoof-mac-include.patch"
+sha256sums="a9803a7a02ddfe5fb9704ce86f0ffc48453c321e88db85810db411ba0841152a dsniff-2.4b1.tar.gz
+9d5178458b0fc714b267912d875166483cf21fdde142e27353db9018328ed421 0001-rewrite-and-modernize-POP-decoder.patch
+edf263eba3c27b1f13112e0ddac86fb858ed793a7710af162b9af3f5209b82ff 01_time.h.patch
+58f5ab7b2751bcc384f94572340560a7c015b76a7204a3f8cc16356e176f2178 02_mailsnarf_corrupt.patch
+96712a03b7663c17aadf61bb91aa3ca73bb93c39d08849596ed7dea236c48853 03_pcap_read_dump.patch
+1cebf870fc5894cd2c205e265337b0c6ec34da22b5857b680e0b58dcc7683866 04_multiple_intf.patch
+afc4a848c624facd2a6b61d372dab740a5a1274c467be6fbee107292800a8bcf 05_amd64_fix.patch
+c9d0bea7ce548ff2254d860ca611759911637532d254d61231a9407268ea4574 06_urlsnarf_zeropad.patch
+0631f50e9401a66da3becfc2606d959f04de522dd466c28425386f889a35bd49 07_libnet_1.1.patch
+4801b61e6576186a43672cbc6b3bdfdc807f3e9edbb0fc67b60275aec6de4bbc 08_checksum.patch
+b13c63a1dc397ab9dcc30dd752a8c61f9f5dfca147308e12f610beaa7cbf0b26 08_openssl-0.9.8.patch
+6abaeaf5be99bdf9fa4f8e259bd1ed140bfa2dc675bc3d151c005ac51785bbff 09_sshcrypto.patch
+b44d9e17a6622dee71e10e3314581f27dd580c631ccf6a453547b58ac7e2c9fa 09_sysconf_clocks.patch
+a1aec0931ab00e74ca87e95992073667d5759045f285f5ee4051941128bc611d 10_urlsnarf_escape.patch
+7c330337839d87499dbae1b7a4bb9ee328b94194f5736dac1daab49637e62248 11_string_header.patch
+dca463ee66dec2922c35362016a6896a56f1dda2885d0a1a3f4a07019615bc79 12_arpa_inet_header.patch
+67fa84845dc1dfacad55e3879762ace8f5e0eee615f5592528a16db5c4ec1c66 13_pop_with_version.patch
+807d4cacaeb2fb6800883e488f8605ba96d6b33903f2be07153bbf1b4bc1ab0d 14_obsolete_time.patch
+2aa6ef949cae80d6af95db835a70ec35a6fa48befdaf02e31796b5b4a2aa3e94 15_checksum_libnids.patch
+56f254219704d7cb53b29b968152050190117b8b57d2feec392094ea46f317ab 16_TDS_decoder.patch
+0d53b676860c1e69b1e93319f56833d1f05855615ace2c05f2e6658b8a219f41 20_debian_dirs.patch
+77fcfff3adf0c8451e1cf82630f835dc8eb74884b75d38c17c3dd973e226f37b 21_msgsnarf_segfault.patch
+8aab402095a1257bb8f9fdd25c6ea7edd3d77a98a7290cda75a9200a53fb4baa 22_handlepp.patch
+3dfe485d08aff96bf6e8f816c596e96cb4b2142bb78aceeebc1fa3fff623fe43 23_urlsnarf_timestamp.patch
+f7d32877e072863ef8cf2815e524134a4a6d55ecfeb9ea35829e0f80c192d73f dsniff-rpc.patch
+7d9ee48a35547462c63f01d7e39c2da5d841555e1cdce77e70582ab5c97a7e0f dsniff-xcompile.patch
+3e2d3a1bb43494a35130a841c35a94dfef26b91dc1ca9ee7b3550a76d8067aa0 0001-arpspoof-add-r-switch-to-poison-both-directions.patch
+62e3f6b45e2ef62bf4c2377aa71fabc93c4ba58d683cabea53f2744e6212b19c 0002-arpspoof-allow-use-of-of-multiple-targets.patch
+a0e421cadac515e5af70aa68ea3d9ecccb3a26ebeeab2432dc94d89f47dbb2ee 0003-arpspoof-allow-selection-of-source-hw-address.patch
+53d690704b176f143f61ecda7533466de3fba9de5470fece0dbd5fcd6ca3c996 0004-arpspoof-mac-include.patch"
+sha512sums="62dafab293de6dc3e9b01561b3627d63ca334467c01c3550a6318d8bcbe99d5a301ec16967af34065a14e8bca1c4b6a41da766cbd51ebd8338615b950c4f642f dsniff-2.4b1.tar.gz
+915baababfeac98de7586579c5b1f615e7698ef43473cefdef6859e799eb4100034bd35b4d4e02b269f796c06fd334a9b224e86b6fa5c2cdb7fb96baa4b50cb6 0001-rewrite-and-modernize-POP-decoder.patch
+cf6bd7530bd58dad61b4957673d438be85904fe9d7dfa6b252363a7f0340978a354ab3bcdf9c0bb69d0a53844476bbc963be71440dcddc6efbc86f6edae4e0e8 01_time.h.patch
+c3980e60335602065d3a796caa27bf46e9eb1a1502f8caad37c7e86eca1b1981d90ce306114011595d3a5c07e34a4e1a0c8f745169f6764c50ca9719459aad1d 02_mailsnarf_corrupt.patch
+bcc2e52d8cb3cbcaf2a2ab1ea3dd49cdf18aef9a46a09751fc7784bfc4963a244365b5d9d8e78ed5912eef8d449e51a46a7168e628bc8223ca60e22b54665fea 03_pcap_read_dump.patch
+39322ca53852026d57e5f389aa419a34612690748443d492f7d67122ef6420ad82edf1746fee2e9d8db837f4a5b2e44f94fcd8dd6c050346e0b30562777b883d 04_multiple_intf.patch
+e5319e0797b7cf9e77c1e60bd86295ea972896f35b5157eaeb20a65f076c2dea2c61dc854cc39642619945206cfccacb3c19ea68667887f0bc1f40097fbd502e 05_amd64_fix.patch
+b612c951722dbdeba95f9014b7c1bbb28af00f558eafaf3255e32652481db3c685c4c2957e330541d16e65314ef5c4c1902899e09b7f1805b5f7855bccf59c0a 06_urlsnarf_zeropad.patch
+50cef510bc056dce6a5c25787f01ac2edc399adc58e43558d2cde15e4538f0dacd44465ca0d0f90f3fbb16ea6f63e795a43aa09d1a62dc45b312ef0de61abb0f 07_libnet_1.1.patch
+f08552e2bd549b05a91e094432dc593c00896508cf161af1bb08e7c60f13e7a674eb6af9a3bfca268cdc8a8281b5f966d94e6b068e9fcf5bc6c5ed6e58d5b3fe 08_checksum.patch
+2123916a44db960df19dde7f77b1066135a9b3aad8351b407896b494fca99e72916829560749b29372f254d046571d59c0f48c6cdd57b63ed839dc63f6640b36 08_openssl-0.9.8.patch
+e5f043cfa684bfb6ebbe711fdb9b1af801aa8ff967b013fc1520b54626ef8edddee311a60cc9cbe89086b8c4aa962ae658821754e6584f632b4b393b258fdb5d 09_sshcrypto.patch
+acd4f1551c12d29e67848210dd08876d3a0e948f5f1ab995a0dd12684a78ac8df382739d69058eaeb454f584ce26c1a43c597f5bd4668c2855bc9a6ef4e1ea90 09_sysconf_clocks.patch
+1467f75d2e77705b622273a39810b4228f7b767f4219d1b4acca6450b8f0fbb12f47e162a5d251df6f1de001645b8cf194a4795457d8f390a42dff9ce7c284f2 10_urlsnarf_escape.patch
+ba5543784b692c7fcd8147ff5d1036867ee4d01ccb1dd252867ba317bc24b7bee238147033b9c57e393ac4b4c6f9f250a819816ab918fb45d44c7b249c775234 11_string_header.patch
+7d3fd53ce55a6d4b7c0a4150712fabe233e1ba818b18a4402d6aea7ace32d9b67956b00f93cd607ba9815a5fd7fe978a489844b8fa7bd1e1154e21c2b96f4491 12_arpa_inet_header.patch
+bd956a4ff665ac3181a3e4f4c589d0ba561d05e124b1c98bbf2a057060bedae8f4f2d91de917f36c2b31222a6fc17fd6e7ddefc31f1774327e192fbf3ad6b463 13_pop_with_version.patch
+c73e9ef34e3882ce618473191f8448567d6c61dda9122269a4734097a3cc86ac2dd384df79cd9af4c955587de05bd8724997e50791f53a5fcdaacabcc4038cbb 14_obsolete_time.patch
+c7aa23f46ab8e4ddcdeb38322810b2ed1299868c94e14a10a97f271ace05f9e3e8fd2ddf85c520140a01013a1ccca912fd1a1ef22a59832c798a1292befb97aa 15_checksum_libnids.patch
+16144a7f32bd7b9538f21fad0be73b172a3a7afe130e79490ddb0f510cec67e67c2d71bf961c4ccad95cbc59d725e29a0c0000b62ca9d0bd059b29ec0fdc07b9 16_TDS_decoder.patch
+cb3fa450cc066895bc516233884c444a8a17af7376cd2bae48cb890dd742dffe0a98a397f2f6f100f680b80399c5812d9705383291c3c2450be93a1b86a65fa4 20_debian_dirs.patch
+18b727a2f77d5be5ca3648ce1875bfaa299d37ea6477752e54daad62797c78214518470f817a6607b4f2ff10a3c89398115019e81b3f47d02f4d26909fc6a5bd 21_msgsnarf_segfault.patch
+e3f4590910bd31280da8b5664b3bad4fb6f7b5da0c61f9841d5bc87ef5bf3fdb824b1d7e2e2cc8a1d446e81e2afca3c503b1ea60102ea08d415d0feae18c0bbc 22_handlepp.patch
+a2eebbe577c6c7a7a6b89eb53971ecc243b36ae42a65bc783936f6cec1d29366c0074e3f7c89728c3e94034e5018f2e9533a2a78fe6e1c839b57208cfd415e52 23_urlsnarf_timestamp.patch
+b5e4a4f347b236fb97d7bafe86306cdbda381673fc4e90ab727fe4f13b5246a7874d0f8b5c02fb6a6d5778e124edc4a140e7bdd666c29399c44f2694238b0061 dsniff-rpc.patch
+b5a9e4133640f5eb3d08a6e9b9f4d7550d3d32fd937c8beb5e6fd5a35e3cf7ba7c8d5dd7ed1597e50c312af8aa792dc4bc9ecc61693fd7b0d449940e93b5b30d dsniff-xcompile.patch
+c360f83d0d52b88acee21f3d3bbde55ed132e19b003bdb7d6edaf0d4a2fc3e6ac9b69c983ebb8be6548465f98728983a9ed7786cb2b052fa6c0769593b470aa2 0001-arpspoof-add-r-switch-to-poison-both-directions.patch
+6fe3863ec30fc1d27f3f81cb954307b6f17752cf0b107f915ccc83096f9866e83a70e6a005ef7174074e7d2b65b2ffad5339d1df9137af002d94b0dd69739b61 0002-arpspoof-allow-use-of-of-multiple-targets.patch
+16bed71ca79a4f5eb74f67f834f0fea5819f0a9300ec2687a67d22bc6acb81dcf36fcf9c2e0d2503c7cc625d810706003d6d1639772fc469b827428333bf9cb1 0003-arpspoof-allow-selection-of-source-hw-address.patch
+c6a75d0300fbccc72143ea6e553b8a25beb17c60870bb4b4cbbc5ba348205af51bdff0669ffe6f5e69c5df80d3f276d88c974c7d604a93a2b3231f9e4c8cb56c 0004-arpspoof-mac-include.patch"
diff --git a/testing/dsniff/dsniff-rpc.patch b/testing/dsniff/dsniff-rpc.patch
new file mode 100644
index 0000000000..17e11cebda
--- /dev/null
+++ b/testing/dsniff/dsniff-rpc.patch
@@ -0,0 +1,92 @@
+this patch removes the functionality that depends on sun rpc,
+which either cannot be implemented using the portablexdr rpc
+replacement library, or depend on the host rpcgen utility
+to generate some headers and source files.
+
+it should be possible to build some of the disabled files
+(for example decoding of NFS packets) with rpcgen installed
+on the host; however i think it's too much of a burden to
+force the crosscompile user to install portablexdr on his host
+as well (to get the utility).
+a viable alternative could be to generate those files on a host
+with rpcgen installed and ship them together with the package.
+
+there's still functionality using rpc enabled, since the entire
+file logging infrastructure uses xdr structures and functions
+to store records, fortunately this functionality is provided
+by portablexdr.
+
+additionally it disables build of the obsolete sshmitm utility.
+obsolete because noone uses SSHv1 anymore.
+the reason for disabling it is that it uses deprecated DES
+functions/types from openssh which are disabled in our build,
+causing the build to fail.
+
+--- dsniff-2.4.org/Makefile.in 2014-08-13 00:44:31.072293717 +0200
++++ dsniff-2.4/Makefile.in 2014-08-13 01:44:17.556299388 +0200
+@@ -47,28 +47,26 @@
+ RANLIB = @RANLIB@
+
+ HDRS = asn1.h base64.h buf.h decode.h hex.h magic.h options.h \
+- pathnames.h pcaputil.h record.h rpc.h tcp_raw.h trigger.h \
++ pathnames.h pcaputil.h record.h tcp_raw.h trigger.h \
+ version.h vroot.h
+
+-SRCS = asn1.c base64.c buf.c hex.c magic.c mount.c pcaputil.c rpc.c \
++SRCS = asn1.c base64.c buf.c hex.c magic.c pcaputil.c \
+ tcp_raw.c trigger.c record.c dsniff.c decode.c decode_aim.c \
+ decode_citrix.c decode_cvs.c decode_ftp.c decode_hex.c \
+ decode_http.c decode_icq.c decode_imap.c decode_irc.c \
+- decode_ldap.c decode_mmxp.c decode_mountd.c decode_napster.c \
++ decode_ldap.c decode_mmxp.c decode_napster.c \
+ decode_nntp.c decode_oracle.c decode_ospf.c decode_pcanywhere.c \
+- decode_pop.c decode_portmap.c decode_postgresql.c decode_pptp.c \
++ decode_pop.c decode_postgresql.c decode_pptp.c \
+ decode_rip.c decode_rlogin.c decode_smb.c decode_smtp.c \
+ decode_sniffer.c decode_snmp.c decode_socks.c decode_tds.c \
+- decode_telnet.c decode_vrrp.c decode_yp.c decode_x11.c
+-
+-GEN = mount.h mount.c nfs_prot.h nfs_prot.c
++ decode_telnet.c decode_vrrp.c decode_x11.c
+
+ OBJS = $(SRCS:.c=.o)
+
+ LIBOBJS = dummy.o @LIBOBJS@
+
+-PROGS = arpspoof dnsspoof dsniff filesnarf macof mailsnarf msgsnarf \
+- sshmitm sshow tcpkill tcpnice @TCPHIJACK@ urlsnarf webmitm @WEBSPY@
++PROGS = arpspoof dnsspoof dsniff macof mailsnarf msgsnarf \
++ sshow tcpkill tcpnice @TCPHIJACK@ urlsnarf webmitm @WEBSPY@
+
+ CONFIGS = dsniff.magic dsniff.services dnsspoof.hosts
+
+@@ -77,14 +75,6 @@
+
+ all: libmissing.a $(PROGS)
+
+-mount.c: mount.x
+- rpcgen -h mount.x -o mount.h
+- rpcgen -c mount.x -o mount.c
+-
+-nfs_prot.c: nfs_prot.x
+- rpcgen -h nfs_prot.x -o nfs_prot.h
+- rpcgen -c nfs_prot.x -o nfs_prot.c
+-
+ $(LIBOBJS):
+ $(CC) $(CFLAGS) $(INCS) -c $(srcdir)/missing/$*.c
+
+--- dsniff-2.4.org/decode.c 2014-08-13 00:44:31.073293717 +0200
++++ dsniff-2.4/decode.c 2014-08-13 01:55:45.228300475 +0200
+@@ -53,6 +53,12 @@
+ extern int decode_vrrp(u_char *, int, u_char *, int);
+ extern int decode_ypserv(u_char *, int, u_char *, int);
+ extern int decode_yppasswd(u_char *, int, u_char *, int);
++#ifndef HAVE_RPC
++int decode_portmap(u_char *a, int d, u_char *b, int c) {return 0;}
++int decode_mountd(u_char *a, int d, u_char *b, int c) {return 0;}
++int decode_ypserv(u_char *a, int d, u_char *b, int c) {return 0;}
++int decode_yppasswd(u_char *a, int d, u_char *b, int c) {return 0;}
++#endif
+
+ static struct decode decodes[] = {
+ { "hex", decode_hex },
diff --git a/testing/dsniff/dsniff-xcompile.patch b/testing/dsniff/dsniff-xcompile.patch
new file mode 100644
index 0000000000..e282a268dd
--- /dev/null
+++ b/testing/dsniff/dsniff-xcompile.patch
@@ -0,0 +1,56 @@
+--- dsniff-2.3.org/configure 2014-08-12 23:09:56.696284744 +0200
++++ dsniff-2.3/configure 2014-08-12 23:21:46.476285867 +0200
+@@ -3035,11 +3035,7 @@
+ ;;
+ esac
+ else
+- if test -f ${prefix}/include/pcap.h; then
+- PCAPINC="-I${prefix}/include"
+- PCAPLIB="-L${prefix}/lib -lpcap"
+- elif test -f /usr/include/pcap/pcap.h; then
+- PCAPINC="-I/usr/include/pcap"
++ if true ; then
+ PCAPLIB="-lpcap"
+ elif test -f /usr/include/pcap.h; then
+ PCAPLIB="-lpcap"
+@@ -3083,12 +3079,7 @@
+ ;;
+ esac
+ else
+- if test -f ${prefix}/include/libnet.h; then
+- CFLAGS="$CFLAGS `${prefix}/bin/libnet-config --defines`"
+- LNETINC="-I${prefix}/include"
+- LNETLIB="-L${prefix}/lib -lnet"
+- elif test -f /usr/include/libnet.h; then
+- CFLAGS="$CFLAGS `libnet-config --defines`"
++ if true ; then
+ LNETLIB="-lnet"
+ else
+ echo "$ac_t""no" 1>&6
+@@ -3128,10 +3119,7 @@
+ ;;
+ esac
+ else
+- if test -f ${prefix}/include/nids.h; then
+- NIDSINC="-I${prefix}/include"
+- NIDSLIB="-L${prefix}/lib -lnids"
+- elif test -f /usr/include/nids.h; then
++ if true; then
+ NIDSLIB="-lnids"
+ else
+ echo "$ac_t""no" 1>&6
+@@ -3193,13 +3181,7 @@
+ ;;
+ esac
+ else
+- if test -f ${prefix}/include/openssl/ssl.h; then
+- SSLINC="-I${prefix}/include"
+- SSLLIB="-L${prefix}/lib -lssl -lcrypto"
+- elif test -f ${prefix}/ssl/include/openssl/ssl.h; then
+- SSLINC="-I${prefix}/ssl/include"
+- SSLLIB="-L${prefix}/ssl/lib -lssl -lcrypto"
+- elif test -f /usr/include/openssl/ssl.h; then
++ if true ; then
+ SSLLIB="-lssl -lcrypto"
+ else
+ echo "$ac_t""no" 1>&6