首页 > 解决方案 > 数据包字段枚举为字符串

问题描述

我想获取数据包字段的字符串表示形式,例如:

pkt[BOOTP].op == 'BOOTREPLY'

到目前为止,我发现的唯一麻烦的方法是:

 pkt[BOOTP].fields_desc[0].i2repr(pkt[BOOTP], 2)

还有什么想法吗?

标签: enumsscapy

解决方案


您可以使用sprintf

pkt.sprintf("%BOOTP.op%")

推荐阅读