summaryrefslogtreecommitdiff
path: root/package/dsniff/patches/patch-arpspoof_c
diff options
context:
space:
mode:
Diffstat (limited to 'package/dsniff/patches/patch-arpspoof_c')
-rw-r--r--package/dsniff/patches/patch-arpspoof_c172
1 files changed, 0 insertions, 172 deletions
diff --git a/package/dsniff/patches/patch-arpspoof_c b/package/dsniff/patches/patch-arpspoof_c
deleted file mode 100644
index 6d8a6a35c..000000000
--- a/package/dsniff/patches/patch-arpspoof_c
+++ /dev/null
@@ -1,172 +0,0 @@
---- dsniff-2.4.orig/arpspoof.c 2001-03-15 09:32:58.000000000 +0100
-+++ dsniff-2.4/arpspoof.c 2009-12-11 13:14:45.000000000 +0100
-@@ -14,6 +14,7 @@
- #include <sys/types.h>
- #include <sys/param.h>
- #include <netinet/in.h>
-+#include <netinet/if_ether.h>
-
- #include <stdio.h>
- #include <string.h>
-@@ -25,9 +26,9 @@
- #include "arp.h"
- #include "version.h"
-
--extern char *ether_ntoa(struct ether_addr *);
-+//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 +42,49 @@ usage(void)
- }
-
- 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__
-@@ -113,13 +116,13 @@ arp_find(in_addr_t ip, struct ether_addr
- 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. */
- 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 +139,9 @@ cleanup(int sig)
- 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 +154,8 @@ main(int argc, char *argv[])
- {
- 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 +167,7 @@ main(int argc, char *argv[])
- 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 +180,26 @@ main(int argc, char *argv[])
- 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);
- }