Henrik
Henrik

Reputation: 13

Reading diameter.imsi from PCAP with Pyshark

I'm trying to get the IMSIs from packets in a .PCAP-file using Pyshark.

When I run the following:

capture = pyshark.FileCapture(pcap_file, display_filter="diameter")

for packet in capture:
    if 'diameter' in packet:
        print(packet)

I get lots of layers and info, e.g.

Layer DIAMETER
:   Version: 0x01
    Length: 568
    Flags: 0x40, Proxyable
    0... .... = Request: Not set
    .1.. .... = Proxyable: Set
    ..0. .... = Error: Not set
    ...0 .... = T(Potentially re-transmitted message): Not set
    .... 0... = Reserved: Not set

Some has:

...
IMSI: 31217054...

But I can't figure out how to get the IMSI if it is in the packet.

And I have tried stuff like imsi = packet['diameter'].imsi but that doesn't work.

Upvotes: 0

Views: 102

Answers (0)

Related Questions