0

Is there a way to get the packet's layer field value information ?
(i.e. The string info displayed to the right when printing the packet layer)
like the lines below:
Protocol discriminator: Mobility Management message
Skip Indicator: No indication of selected PLMN

e.g.

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

 .... 0101 = Protocol discriminator: Mobility Management messages (0x5)
 0000 .... = Skip Indicator: No indication of selected PLMN (0)
 ...
 ...
 ...
Popa
  • 273
  • 1
  • 4
  • 13

1 Answers1

0

Simply saving it as str(packet[0]['IP']) or packet[0]['IP'].__str__() should do the trick (which is equivalent btw).

For example:

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

fane96
  • 11
  • 1
  • I dont want all the layer (IP), I want only the description of the value of specific field: i.e. for this field: " .... 0101 = Protocol discriminator: Mobility Management messages (0x5)" I need only the string: "Mobility Management messages" – Popa Nov 21 '19 at 15:26