python - 如何为 scapy 创建一个图层?
问题描述
我正在尝试从 scapy 创建未实现的蓝牙层,但是在尝试了几次之后我没有得到任何结果。根据 scapy 文档,我所做的只是子类Packet
,并将新层类绑定到上层......是否需要进行一些其他修改才能使其工作?
PS:我知道它不起作用,因为列出了几个软件包wireshark
,btmon
但是在 scappypacket.show()
中没有出现
编辑:
我尝试实现的层操作码是 0x33 <用户确认请求>。绑定层是这样的:
bind_layers(HCI_Event_Hdr, HCI_Event_User_Confirmation_Request, code=0x33)
数据包类是这样的:
name = "User Confirmation Request"
fields_desc = [LEMACField("address", None), IntField("number", 0)]
def answers(self, other):
if HCI_Command_Hdr not in other:
return False
return other[HCI_Command_Hdr].opcode == self.opcode
该层由 BD_Address 和数值(4 个八位字节/字节)构建
解决方案
推荐阅读
- wordpress - 具有多个 URL 的自定义帖子类型(每个分配的术语 1 个)
- markdown - 如何使用 kramdown 在行尾生成 \\?
- kotlin - UML 中的类型化聚合
- java - 具有冲突名称的 wsimport 生成
- python - 在 smtplib 发送的邮件中显示用户名
- macos - zsh: fork failed: 资源暂时不可用
- javascript - 如何在 jquery 中优化 ajax 响应?
- sql-server - 仅使用 SQL 语法生成创建存储过程脚本
- java - 如何将JMeter(主从)的端口配置到防火墙
- python-3.x - Tensorflow 加载数据集:UnimplementedError:Append(absl::Cord) 未实现 [Op:TakeDataset]