for ts, data in pcapReader:
    ether = dpkt.ethernet.Ethernet(data)
if ether.type != dpkt.ethernet.ETH_TYPE_IP:
    raise
ip = ether.data
src = socket.inet_ntoa(ip.src)
dst = socket.inet_ntoa(ip.dst)
print('%s -> %s' % (src, dst))
How can I filter a pcap file by specific protocol using python?