I have a device in my local network and know its MAC Address. It gets it's IP address automatically via DHCP. I want to obtain this IP.
I don't want to use nmap but scapy would be fine, as I'm importing from a kivy app.
I found:
from scapy.all import srp, Ether, ARP
ans,unans=srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst="192.168.1.0/24"),timeout=2)
and with
ans.summary()
I get the following output:
Ether / ARP who has 192.168.43.1 says 192.168.43.92 ==> Ether / ARP is at 3e:f8:d9:45:1b:3d says 192.168.43.1
My two problems are:
1: I have to run the script with sudo python and I'm not sure about the permissons in kivy.
2: Is there a simple way to get the variables for IP/MAC out of the .summary()?