from scapy.all import * from scapy.layers.inet import IP pkts = rdpcap("path/to/pcap_file") pkt1 = pkts[0] # Get first packet ip_hdr = pkt1[IP] src_ip = ip_hdr.src # Get source ip dst_p = ip_hdr.dst # Get destination ip