如何在自定义Scapy类中设置我的字节大小?
有人可以帮我提供示例代码。 我想使用Scapy创建此数据包结构:
MyPacketStructure:
field1: 2 bytes
field2: 16 bytes
field3: 12 bytes
field4: 17 bytes
data: 83 bytes
如何为上述数据包结构定义SCAPY类?
class MyPacketStructure(Packet):
what type do i use to set ("field1") for 2 bytes
what type do i use to set ("field2") for 16 bytes
what type do i use to set ("field3") for 12 bytes
what type do i use to set ("field4") for 17 bytes
what type do i use to set ("data") for 83 bytes
我看到字节菲尔德,但这只是一个字节。哪个SCAPY数据类型让我设置该字段的字节数。
对于数据字段或有效载荷,推荐的数据类型是什么?如果我只有43个字节会怎样?如何为数据字段添加其他40个字节?
任何帮助将不胜感激。先感谢您。
Can someone please help me with an example code.
I would like to use scapy to create this packet structure:
MyPacketStructure:
field1: 2 bytes
field2: 16 bytes
field3: 12 bytes
field4: 17 bytes
data: 83 bytes
How do I define a scapy class for the above packet structure?
class MyPacketStructure(Packet):
what type do i use to set ("field1") for 2 bytes
what type do i use to set ("field2") for 16 bytes
what type do i use to set ("field3") for 12 bytes
what type do i use to set ("field4") for 17 bytes
what type do i use to set ("data") for 83 bytes
I see ByteField but it's only one byte. Which scapy datatype let's me set the number of bytes for that field.
For the data field or payload, what is the recommended datatype? What happens if i only 43 bytes? How do I pad the other 40 bytes for the data field?
Any help would be appreciated. Thank you in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论