blob: 4741d45fc3a02cc20a3d1bcfc2b584967ccebc74 (
plain)
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
|
#!/usr/local/bin/python3
print("send icmp6 with destination options header")
import os
import sys
from struct import pack
from addr import *
from scapy.all import *
if len(sys.argv) != 2:
print("usage: icmp6_dst.py Nn")
exit(2)
N=sys.argv[1]
IF=eval("IF_"+N);
ADDR6=eval("ADDR6_"+N);
pid=os.getpid()
eid=pid & 0xffff
payload=b"ABCDEFGHIJKLMNOP"
packet=IPv6(src=ADDR6, dst=ADDR6)/ \
IPv6ExtHdrDestOpt()/ \
ICMPv6Unknown(type=6, code=0, msgbody=payload)
# send does not work for some reason, add the bpf loopback layer manually
#send(packet)
bpf=pack('!I', 24) + bytes(packet)
sendp(bpf, iface=IF)
|