Monitor when a device disconnects my wifi network

497 views Asked by At

I am working on a simple hobby project that checks when users connect/disconnect from my wifi network.

What works: I have a Python script running on Mac OS 10.6 that basically tails the system log /var/log/system.log. So, the script just checks for the MAC Address of my iPhone and if it finds it, it knows that I've connected.

What I am trying to do: Now, I am trying to find when this iPhone disconnects my wifi network (Although, I don't need to know what networks it ends up joining next). I tried looking at some NMAP Commands to check for the DHCP lease file but haven't been successful yet.

Can someone please help me out?

1

There are 1 answers

3
Simon Urbanek On BEST ANSWER

Devices typically don't "disconnect" from DHCP - the leases simply expire and that can take hours or weeks depending on the DHCP settings. However, iPhones do respond to pings while on WiFi so you can ping it periodically to find out whether it is still connected.