summaryrefslogtreecommitdiff
path: root/regress/sys/net/pf_opts/icmp_eol.py
blob: f0047d7e3146f88f56c66ae651d96e1527d79e3e (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
#!/usr/local/bin/python3

print("send icmp with option end of list")

import os
import sys
from addr import *
from scapy.all import *

if len(sys.argv) != 2:
	print("usage: icmp_eol.py Nn")
	exit(2)

N=sys.argv[1]
IF=eval("IF_"+N);
ADDR=eval("ADDR_"+N);

pid=os.getpid()
eid=pid & 0xffff
payload=b"ABCDEFGHIJKLMNOP"
packet=IP(src=ADDR, dst=ADDR, options=b"\001\000\001\001")/ \
    ICMP(type=6, id=eid)/payload

send(packet, iface=IF)