A Python script for discovering devices on the local network using ARP, UPNP.
Currently this script works for Windows, WSL and Linux.
Code formatters: Black, isort
- Retrieve the current ARP cache tables for all interfaces.
- Parse the ARP caches tables for individual device entries.
- Perform OUI lookup of device MAC address to obtain device vendor.
- Send M-SEARCH request via Multicast UDP.
- Receive Unicast UDP response from compatible devices.
- Retrieve and parse the XML description file from each device to obtain device attributes.
Requires Python 3.9+ installed. You can download the latest version of Python 3 via the official website
Once Python has been installed, ensure you have the Python library dependencies installed as well:
$ cd .\network_device_discovery\
$ python -m pip install -r requirements.txt
On Linux the ARP utility may need to be installed as part of the net-tools package:
sudo apt-get install net-tools
To run the script, you simply use the Python command:
$ python discover.py
Results will be displayed to the terminal in a color coded table with some nice ascii art.
Note:
Although this script can be used inside a VM, the results may be limited, depending on how your VM is networked. Try the VM network connection as Bridged (Connected directly to the physical network) and not NAT (Sharing the host's IP address). Otherwise some of the discovery methods relying on sockets may not work.