Trying to write a script that performs ARP scanning of the local network. With the help of Google, I wrote the following code: (here, the Range is set to the type "192.168.0.0/24")
import sys import logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import srp, Ether, ARP, conf def scan(Range): conf.verb = 0; alive,dead = srp(Ether(dst = "ff:ff:ff:ff:ff:ff") / ARP( pdst = Range ), timeout = 2, verbose = 0) return alive But there were 3 problems:
1) The script does not work if I connected to the network via WiFi.
2) I need to support 2 ways to set the scan range:
(192.168.0.0/24) or (192.168.0.1 - 192.168.0.255). I was able to implement only the first.
3) Scanning results are unstable, can find 2, can find 4 hosts with unchanged network status, what can this be connected with?
How can I do what I need? In Python newbie.
arputility shows? What time is your arp cache stored? What is OS? 3- Why don't you use arping ()? - jfsifaceparameterifacecorrect on my machine (and does not receive if it is incorrect). If you do not know "how to get a list of network interfaces on Windows" ask a separate question. Start withget_if_list(). - jfs