Send notifications who leaves or enters home by cellphones, laptops etc.
1: Someone has found a better way to detect iphones but my coding skills suck to translate this C# code to python. HERE
2: Thought on doing also some tcpdump
to check if a device is sending stuff like discovery services etc. So it aways listens.
3: Might be better if we had control over the router/modem, DD-WRT, relay all traffic to the host idk.
4: Use nmap api.
5: WIFI dongle usb monitor mode.
6: The volume of the pushetta notification is loud as fuck lol.
REQUIREMENTS:nmap
, sudo
, python3, see install file.
-
Register in http://www.pushetta.com.
-
Create a channel in pushetta and grab your api key from the dashboard.
-
Paste the api key and channel name in the
configuser.py
file, also paste your ip range. -
Do
sudo pip3 install pushetta.
-
Install pusheta in your phone.
-
Subscribe to your channel in the app.
-
Use
nmap
or Fing (android app) to determine the MAC adresses of the devices you wanna keep track. -
Add those MAC adresses to
idsuser.csv
file with the formatMACADDRESS,NAMEDEVICE
it already has some example mac addresses. -
Script must run as root, or
sudo
.(i thinknmap
requires this for mac addresses). -
To start at boot add this line
python3 /home/pi/ph/ph.py &
to/etc/rc.local
in the line before exit 0, depending on you distribution.
Takes idsuser.csv
creates a list of of booleans wherever a device is detected.
pseudocode
12:23:DE,[True ,False,True ]
23:EF:43,[False,False,False]
Then it creates another list, this list contains bools if the device has been seen at least once during the cycle.
12:23:DE,[True ,False,True ,.....] -> 12:23:DE,True
23:EF:43,[False,False,False,.....] -> 23:EF:43,False
Then it begins another cycle. For another 10~ itinerations, and appends another boolead True if the device has been seen at least once.
12:23:DE,[False,False,True,....] -> 12:23:DE,True
23:EF:43,[True ,True ,True,....] -> 23:EF:43,True
Then it compares the resulting lists from the last two cycles looking for change so.
False then False : device is not present dont send notification
True then True : device is present dont send notification
False then True : device was not present, then is present so send notification is has arrived
True then False : devces was present, then is not present so send notification is has left
Then it repeats using the last cycle as starting point.