【问题标题】:Packet layer field value information包层字段值信息
【发布时间】:2019-10-13 15:11:39
【问题描述】:

有没有办法获取数据包的层字段值信息?
(即打印数据包层时显示在右侧的字符串信息)
像下面的行:
协议鉴别器:移动管理消息
跳过指示器:没有选定 PLMN 的指示

例如

packets = pyshark.FileCapture(...)
print(packet[0]['IP']):

 .... 0101 = Protocol discriminator: Mobility Management messages (0x5)
 0000 .... = Skip Indicator: No indication of selected PLMN (0)
 ...
 ...
 ...

【问题讨论】:

    标签: pyshark


    【解决方案1】:

    只需将其保存为 str(packet[0]['IP']) 或者 packet[0]['IP'].__str__() 应该做的伎俩(这是等效的顺便说一句)。

    例如:

    m_list.append(str(packet[0]['IP'])) with open("out.txt", "w") as f: f.write(m_list)

    【讨论】:

    • 我不想要所有层(IP),我只想要特定字段的值的描述:即对于该字段:“ .... 0101 = 协议鉴别器:移动管理消息(0x5 )" 我只需要字符串:"Mobility Management messages"
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-12-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-02-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多