简体   繁体   中英

How to decode a packet in PyShark as decode_as

In Wireshark GUI, we can decode a UPD packet as RTP, and the same can be done in tshark using d <layer type>==<selector>,<decode-as protocol>

How can i do the same in PyShark ? I tried doing the following

import pyshark

cap = pyshark.FileCapture("Test.pcap", display filter='udp', decode_as='rtp')
for pkt in cap:
   print(pkt)

But it shows the following error

AttributeError: 'str' object has no attribute 'items'

define_as参数应为dict而不是str示例:

decode_as={'udp.port==1234':'rtp'}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM