I am able to read .pcap
file with pyshark
. Here is my code:
packets = pyshark.FileCapture(pcap_dir) # pcap_dir is the directory of my pcap file
To print a packet, I use print(packets[0])
. My question is: how can I convert packets[0]
to its binary value? For example, this can be useful if I want to send the packet again to the network