使用 scapy 生成 LACP 流量
Generate LACP traffic using scapy
我需要使用 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 但我不明白如何使用它
在生成中,你应该让 scapy 放置 link 层的协议类型。
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)
我需要使用 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 但我不明白如何使用它
在生成中,你应该让 scapy 放置 link 层的协议类型。
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)