sniff(wireshark) on scapy printing ping twice with/without python

Viewed 148

Basically I have two machines, in one I the Ubuntu I am running the 'sniff' and in the Kali the 'ping'.

I cannot understand why the code is printing twice, if supposedly only one package is being sent?

I was expecting only the 'Hello World\x00\x00\x00\x00\x00\x00\x00' to be printed.

Why is that happening? How can i fix it?

Thanks in advance!

Ubuntu

from scapy.all import *

def xyz(pkt):
    #hexdump(pkt)
    if pkt['Raw']:
        print(pkt['Raw'])
sniff(count=10, prn=xyz, filter="icmp")

Kali

import logging
logging.getLogger("scapy.runtime").setLevel(logging.ERROR)
from scapy.all import *

ping = Ether()/IP(dst="10.0.2.4")/ICMP()/Raw()
ping['Raw'].load = 'Hello World'
srp1(ping, timeout=2)

enter image description here

1 Answers

I think it's like this:

Ubuntu sends ICMP echo request (first package).
Kali receives and sends ICMP echo reply (second package).

Related