Ip list from captured pcap python
Question: I'm trying to sort a previously-captured Pcap file, I want to build a list of
ip source and destinations, so I can run calculation against them.

I have attempted to search the pcap file using a search function but this
fails with ip addresses, any ideas?

Eventually I want the code to sniff live using the folowing code then build a
list if the ip addresses.

    
    
    newpkt = sniff(count = 100, prn=lambda x:x.sprintf("{IP:%IP.src% -> %IP.dst%\n}     {Raw:%Raw.load%\n}"))
    


Answer: here is the result for anyone who might need it

    
    
    from scapy.all import *
    
    pkts = rdpcap("capture.cap")
    
    test = ""
    for pkt in pkts:
        temp = pkt.sprintf("%IP.src%,%IP.dst%,")
        test = test + temp
    
    print test
    

