Read on packet capturing using pyshark

$python3 read_pcap.py > pcap-result.txt $cat read_pcap.py #!/usr/bin/env python3 import pyshark #cap = pyshark.FileCapture(‘http.cap’, display_filter=”dns”) #for pkt in cap: # print(pkt) cap = pyshark.FileCapture(‘http.cap’, keep_packets=False) def print_info_layer(packet): print(“[Protocol:] “+packet.highest_layer+” [Source IP:] “+packet.ip.src+” [Destination IP:]”+packet.ip.dst) cap.apply_on_packets(print_info_layer) $cat pcap-result.txt [Protocol:] TCP [Source IP:] 145.254.160.237 [Destination IP:]65.208.228.223 [Protocol:] TCP [Source IP:] 65.208.228.223 [Destination IP:]145.254.160.237 [Protocol:] TCP [Source IP:] 145.254.160.237 …