Search code examples
pythonscapy

Simple scapy script not sending packet


I have the most simple scapy script possible but It is not working. Please help:

import scapy.all as scapy

def scan(ip):
    scapy.arping(ip)
scan("192.169.11.117")

When it runs I get this:

Begin emission:
Finished sending 1 packets.

Received 0 packets, got 0 answers, remaining 1 packets

How can I fix this and actually get answers?


Solution

  • Problem #1

    You are likely using the wrong subnet. Private subnets (RFC 1918) are

    • 10.0.0.0/8
    • 172.16.0.0/12
    • 192.168.0.0/16

    You probably meant to do this, which is a private IP address

    scan("192.168.11.117")
    

    and not this

    scan("192.169.11.117")
    

    which is a public IP address. It's also possible that you own this public subnet, in which case this is not relevant.

    Problem #2

    The remote host may not be responding because it doesn't exist at that address. Make sure to double check that the target whose IP you are using in arping is online and accessible.

    You can check arp mappings on *nix and windows by using arp -a on your command line

    $ arp -a
    
    ? (192.168.1.111) at 0:1b:78:20:ee:40 on en0 ifscope [ethernet]
    ? (192.168.1.112) at a4:77:33:88:92:62 on en0 ifscope [ethernet]
    ? (192.168.1.117) at 6c:33:a9:42:6a:18 on en0 ifscope [ethernet]
    ...
    

    for the target IP to make sure that a scapy arping should resolve.


    If you are trying to do an ARP scan, then you should look at Cukic0'ds answer.