scapysniffer

use scapy sniff the icmp packet which is send to machine C by machine B at machine A


I have 3 pc (A,B,C) and I wanna sniff the ICMP packet when I ping C at B.

(IP(A)=192.168.2.104,IP(B)=192.168.2.105,IP(C)=192.168.2.106 )

I use the python script like this:

from scapy.all import *
    def print_pkt(pkt):
        pkt.show()
    pkt = sniff(filter='icmp',prn=print_pkt,count=1)

but it doesn't work (i have set my card as promisc mode) can you help me! thanks


Solution

  • If you want sniff packets between two device you should be in the middle of them, if you are and you're sniffing packets you should enable ip_forward feature. if you're using Ubuntu enable it this way :

    echo 1 > /proc/sys/net/ipv4/ip_forward