[Python] Sending a packet over physical loopback in scapy

Discussão em 'Python' iniciado por Stack, Setembro 5, 2025.

  1. Stack

    Stack Membro Participativo

    I've recently discovered Scapy & it looks wonderful

    I'm trying to look at simple traffic over a physical loopback module / stub on my NIC.

    But Scapy sniff doesn't give anything

    What I'm doing to send a packet is:

    payload = 'data'*10
    snf = sniff(filter="icmp", iface="eth0")
    for x in xrange(1, 10):
    sendp(Ether(dst=src_mac, src=spoof_src_mac)/IP(dst=dst_ip, src=spoof_src_ip)/ICMP()/payload, iface=ifname)

    f.open('scapylog.log', 'w')
    f.write(str(snf))


    with src_mac = my mac address & dsp_ip my ip address. the "spoof" fields are just random (valid) mac & ip values.

    The resulting sniff / logfile is empty. nothing to report

    I can see that traffic is going in the network through the ifconfig stats of the interfaces that increment each time I call this script - so traffic is flowing...

    If someone has an idea why I'm not seeing my traffic I'd be happy to hear :)

    Thanks!

    Continue reading...

Compartilhe esta Página