1#!/usr/local/bin/python2.7 2 3import random 4import scapy.all as sp 5import sys 6 7UDP_PROTO = 17 8AH_PROTO = 51 9FRAG_PROTO = 44 10 11def main(): 12 intf = sys.argv[1] 13 ipv6_src = sys.argv[2] 14 ipv6_dst = sys.argv[3] 15 16 ipv6_main = sp.IPv6(dst=ipv6_dst, src=ipv6_src) 17 18 padding = 8 19 fid = random.randint(0,100000) 20 frag_0 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=1, offset=0) 21 frag_1 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=0, offset=padding/8) 22 23 pkt1_opts = sp.AH(nh=AH_PROTO, payloadlen=200) \ 24 / sp.Raw('XXXX' * 199) \ 25 / sp.AH(nh=FRAG_PROTO, payloadlen=1) \ 26 / frag_1 27 28 pkt0 = sp.Ether() / ipv6_main / frag_0 / sp.Raw('A' * padding) 29 pkt1 = sp.Ether() / ipv6_main / pkt1_opts / sp.Raw('B' * padding) 30 31 sp.sendp(pkt0, iface=intf, verbose=False) 32 sp.sendp(pkt1, iface=intf, verbose=False) 33 34if __name__ == '__main__': 35 main() 36