dvs
dvs

Reputation: 519

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'

Upvotes: 1

Views: 3758

Answers (1)

balderman
balderman

Reputation: 23815

decode_as argument should be a dict and not str Example:

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

Upvotes: 6

Related Questions