scapy sniff function not catching any packets
Question: I've been following Seitz's black hat python book and he gives an example of
capturing network traffic using the scapy library.

    
    
    import logging
    logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
    from scapy.all import *
    
    def packet_callback(packet):
        print packet.show()
    
    sniff(filter="",iface="any",prn=packet_callback, count = 1)
    

I run the above function as follows: `sudo python sniffer.py` and open google
chrome to a page. No packets get captured. I do a ping request to a domain and
nothing gets captured. I was expecting the `print packet.show()` line to print
the first packet being sent.

All of this is being run on a Macbook Pro on a wireless internet connection.

Can someone help me troubleshoot?


Answer: if you want scapy to sniff on all interfaces, just remove the iface = "any"
parameter. Since "any" is not an interface therefore scapy cannot sniff.

Also remove the filter parameter since it is not applying any filter. The
correct command would like like this.

    
    
    sniff(prn=packet_callback, count = 1)
    

