【问题标题】:Generate LACP traffic using scapy使用 scapy 生成 LACP 流量
【发布时间】:2020-10-15 09:48:15
【问题描述】:

我需要使用 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 但我不明白如何使用它

【问题讨论】:

  • 你能给出你到目前为止所尝试的吗?

标签: python python-3.x generator scapy lacp


【解决方案1】:

在生成中,您应该让 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)

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-06-12
    • 2016-06-19
    • 2014-03-18
    • 1970-01-01
    • 2023-03-08
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多