-
Notifications
You must be signed in to change notification settings - Fork 0
/
spooftest.c
27 lines (20 loc) · 836 Bytes
/
spooftest.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
#include "src/probe.h"
#include "src/sniffer.h"
// This program tests whether the packets with spoofed source addresses can be sent to the
// Internet. You should sniff packets on the destination IPv6 address to identify
// whether the spoofed packets are filtered.
int main() {
setbuf(stdout, NULL);
parseConfig();
struct Probe* probe = (struct Probe*) malloc(sizeof(struct Probe));
initProbe(probe, CFG.interface, (u8*) CFG.gateway_mac);
const char* dst = "2001:1";
const char* fake_src = "2001:2";
// Send packets with real source address
prepareEchoRequest(probe, CFG.src_ipv6_addr, dst, 0, 0, 64);
sendEchoRequests(probe, 1, 0);
// Send packets with spoofed source address
prepareEchoRequest(probe, fake_src, dst, 0, 0, 64);
sendEchoRequests(probe, 1, 0);
return 0;
}