How to extract Raw of TCP packet using Scapy

前端 未结 1 567
傲寒
傲寒 2021-01-02 13:09

I use the sniff function of scapy module. My filter and prn function are doing a great job. But now, I would like to extract the

相关标签:
1条回答
  • 2021-01-02 13:40

    You can get the raw bytes of the packet using scapy.compat.raw1:

    from scapy.all import raw
    raw(packet)
    

    You can print them in a readable format using scapy.compat.bytes_hex2:

    from scapy.all import bytes_hex
    print(bytes_hex(packet))
    

    1 scapy.compat.raw's implementation can be found here.
    2 scapy.compat.bytes_hex's implementation can be found here.

    0 讨论(0)
提交回复
热议问题