我需要使用scapy生成STP和LACP流量。我已经设法为STP做到了这一点:
from scapy.all import STP
import scapy
from scapy.all import *
data='test'
a=Dot3(dst="01:00:0c:cc:cc:cd", src="08:17:35:51:29:2e")/LLC(dsap=0xaa, ssap=0xaa, ctrl=3)/SNAP(OUI=0x0c, code=0x010b)/STP(rootid=8406, portid=0x802e, pathcost=19, rootmac="2c:33:11:53:85:80",bridgeid=32982, bridgemac="08:17:35:51:29:00", bpdutype=128)/data
sendp(a,iface="eth2", count=200)但是我被LACP流量的生成阻塞了,我试图跟踪scapy.contrib.lacp,但我无法理解如何使用它
发布于 2020-10-18 02:15:49
在generate中,您应该让scapy放置链接各层的协议类型。
import scapy.all as scapy
from scapy.layers.inet import Ether, Dot3
from scapy.contrib.lacp import SlowProtocol, LACP
from scapy.layers.l2 import LLC, SNAP, STP
data='test'
pkt = Dot3(dst="01:00:0c:cc:cc:cd", src="08:17:35:51:29:2e") \
/ LLC(dsap=0xaa, ssap=0xaa, ctrl=3) \
/ SNAP(OUI=0x0c, code=0x010b) \
/ STP(rootid=8406, portid=0x802e, pathcost=19, rootmac="2c:33:11:53:85:80",bridgeid=32982, bridgemac="08:17:35:51:29:00", bpdutype=128) \
/ data
pkt.show2()
sendp(pkt, iface="eth2", count=200)
pkt = Ether() / SlowProtocol() / LACP()
pkt.show2()
sendp(pkt, iface="eth2", count=200)https://stackoverflow.com/questions/64368955
复制相似问题