scapy IPv6 NS NA报文构造

NS 报文构造:

 1 #! /bin/python
 2 
 3 from scapy.all import *
 4 
 5 a=IPv6(src='2a01:4f8:161:5300::40', dst='ff02::1:ff00:1')
 6 b=ICMPv6ND_NS(tgt='2a01:4f8:161:5300::1')
 7 c=ICMPv6NDOptSrcLLAddr(lladdr='fa:63:a5:0c:8b:40')
 8 d=ICMPv6NDOptMTU()
 9 e=ICMPv6NDOptPrefixInfo(prefix='2a01:4f8:161:5300::', prefixlen=64)
10 
11 send(a/b/c/d/e)

NA 报文构造:

1 #! /bin/python
2 
3 from scapy.all import *
4 
5 a=IPv6(src='2a01:4f8:161:5300::100', dst='FF02::1')
6 b=ICMPv6ND_NA(R=1, S=0, O=1, res=0, tgt='2a01:4f8:161:5300::100')
7 c=ICMPv6NDOptSrcLLAddr(type=2, lladdr='fa:63:a5:0c:8b:40')
8 sendp(Ether()/a/b/c, inter=0.2, count=10)
原文地址:https://www.cnblogs.com/wangjq19920210/p/10381771.html