receiving packets from a socket in scapy
Question: I am trying to code a basic packet sniffer by listening to a socket in python
and found that we could use the socket library in python and do the following,

    
    
    s = socket.socket( socket.AF_PACKET , socket.SOCK_RAW , socket.ntohs(0x0005))
    

Wanted to know whether if we would do the same in scapy?


Answer: From the [Scapy
Documentnat](http://www.secdev.org/projects/scapy/doc/usage.html#sniffing):

    
    
    from scapy.all import sniff
    
    data = sniff(filter="icmp and host 127.0.0.1", count=2)
    
    print data.summary()
    

