admin管理员组文章数量:1201199
I am trying to extend Scapy's protocol parsing capabilities. Here is my code:
from scapy.all import *
class IEEE1722(Packet):
name = "ieee1722"
fields_desc = [
BitField("subtype", 0, 8),
BitField("header_specific", 0, 1),
BitField("version", 0, 3),
Raw("payload")
]
bind_layers(Ether, IEEE1722, type=0x22f0)
However, when I use it, packet.haslayer(IEEE1722) returns 0. When I run packet.show(), it prints:
###[ Ethernet ]###
dst = 91:e0:f0:01:00:00
src = 00:fc:70:00:00:02
type = 0x22f0
###[ Raw ]###
......
I can see that Ether().payload_guess can print out the protocol class I bound, and the type is also correct. I expect to be able to correctly parse and obtain the layer of my custom protocol.
本文标签: Why does not scapy bindlayers recognize my custom layerStack Overflow
版权声明:本文标题:Why does not scapy bind_layers recognize my custom layer? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738615911a2102906.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论