构造 IPv6 报文
#!/usr/bin/python from scapy.all import * a=IPv6(nh=58, src='fe80::214:f2ff:fe07:af0', dst='ff02::1', version=6L, hlim=255, plen=64, fl=0L, tc=224L) b=ICMPv6ND_RA(code=0, chlim=64, H=0L, M=0L, O=0L, routerlifetime=1800, P=0L, retranstimer=0, prf=0L, res=0L, reachabletime=0, type=134) c=ICMPv6NDOptSrcLLAddr(type=1, len=1, lladdr='00:14:f2:07:0a:f1') d=ICMPv6NDOptMTU(res=0, type=5, len=1, mtu=1500) e=ICMPv6NDOptPrefixInfo(A=1L, res2=0, res1=0L, L=1L, len=4, prefix='2001:db99:dead::', R=0L, validlifetime=2592000, prefixlen=64, preferredlifetime=604800, type=3) send(a/b/c/d/e, inter=1, count=10, iface='eth0')
参考链接:https://www.packetlevel.ch/html/scapy/scapyipv6.html
ICMP请求报文:
#!/usr/bin/python from scapy.all import *
a=IPv6(src='aa::10', dst='ff02::1') b=ICMPv6EchoRequest() send(a/b, inter=1, count=100, iface='eth0')