User avatar
jbeale
Posts: 3625
Joined: Tue Nov 22, 2011 11:51 pm
Contact: Website

determine if house occupied by pinging a smartphone?

Wed Apr 27, 2016 11:47 pm

This isn't specific to the Pi, but I'm sure some of the smart folks here have ideas about this, or maybe have done it themselves.

Let us say, hypothetically, that there are a few people that live in a house, and each person has an Android smartphone which connects to the house wifi hub from time to time to read email etc. Is it in any way practical for a RPi also on the LAN to check for the presence of the known phones from a list (maybe from MAC number), and thereby draw a conclusion "house is occupied" or "house is not occupied"?

Clearly it would not be foolproof, since people sometimes forget to take their phone with them, or may at times turn it completely off. I'm just wondering if it could ever work at all? Does a typical phone appear online only briefly to check for mail and then sleep for long periods of time, thereby appearing offline most of the time?

tweak42
Posts: 530
Joined: Tue Mar 22, 2016 3:16 am
Location: Los Angeles, California

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 2:09 am

I wouldn't bother to go up to IP level to detect presence of a device when you can do it at mac address level.
http://edwardkeeble.com/2014/02/passive-wifi-tracking/

Better yet, use the router the household connects through would be the idea way.
https://community.smartthings.com/t/rel ... ence/37802

I believe the typical smart phone by default keeps checking in periodically for push notifications wither it's instant messages, email or app updates etc. The behavior could be modified automatically by such things at low battery/power saving profile, or the user enabling airplane mode.

stderr
Posts: 2178
Joined: Sat Dec 01, 2012 11:29 pm

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 2:59 am

tweak42 wrote:I wouldn't bother to go up to IP level to detect presence of a device when you can do it at mac address level.
It even seeks to connect to location hotspots that it was previously at so you could tell where the "subject" was recently. These mobile phones leak a lot of personal data.

ghodan
Posts: 118
Joined: Fri Sep 18, 2015 6:05 am

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 5:46 am

With Kali linux on your Pi you can monitor a wifi access point for clients connected.
Use airodump-ng. It should display the mac adres of clients connected to the wifi router you are monitoring.

User avatar
Cancelor
Posts: 772
Joined: Wed Aug 28, 2013 4:09 pm
Location: UK

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 6:35 am

No exactly what you want but ifttt.com can be used to link your own phone to various actions.
Can't find the thread you want? Try googling : YourSearchHere site:raspberrypi.org

Pithagoros
Posts: 580
Joined: Wed Nov 12, 2014 8:16 pm

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 7:30 am

I came to work this morning, forgot my phone. Left it at home.

But my phone has an app on it called fing which identifies connected devices on the connected WiFi wlan by showing them in bold (compared to other devices that have been but are not currently connected, which are light-grey). I think it can also do remote wlans. Anyway, my point is that is that it might be worth having a look at fingbox.com.

nmap/zenmap is Open Source similar thing that might have some ideas in the code.

MaxK1
Posts: 1043
Joined: Sun Aug 26, 2012 11:34 pm

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 9:31 am

Funny - I started thinking about the same thing yesterday... Looking at the output from nmap might work if you are looking for a specific phone. And I suppose for added amusement you could ping the crap out of the associated IP address and drain their battery... ;-)
You are in a maze of twisty little passages, all alike.
When General Failure and Major Disaster get together, Private Parts usually suffers.

bullwinkle
Posts: 117
Joined: Wed Jan 09, 2013 12:14 pm

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 10:25 am

as noted above fing works pretty good.

I did something similar with nmap / bash
http://dumb-looks-free.blogspot.fr/2014 ... vices.html

cheers

edit:
Does a typical phone appear online only briefly to check for mail and then sleep for long periods of time, thereby appearing offline most of the time?

it depends ... Android => Wi-Fi -> Advanced -> Keep Wi-Fi on during sleep

User avatar
solar3000
Posts: 1051
Joined: Sat May 18, 2013 12:14 am

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 1:27 pm

I assume you already know that each cell phone's IP changes many times a day.

I assume you already know:
https://maps.google.com/locationhistory/
And
https://www.google.com/android/devicemanager
Antikythera

User avatar
Douglas6
Posts: 4849
Joined: Sat Mar 16, 2013 5:34 am
Location: Chicago, IL

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 2:42 pm

The Tasker app on my phone knows when the phone connects to a particular WiFi network. It could then 'ping' the Pi. No polling needed. There'd be a problem when the Pi left the building, of course.

User avatar
TimG
Posts: 297
Joined: Tue Apr 03, 2012 12:15 am
Location: Switzerland

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 3:03 pm

I thing fping will do what you want. For example, the following will list all hosts on the lan (adjust the ip address for your network).

Code: Select all

sudo apt-get install fping
fping -g 192.168.1.0/24 -dAq -C1 2>&1 | grep -v Unreachable | grep -v \\-$

tpylkko
Posts: 406
Joined: Tue Oct 14, 2014 5:21 pm

Re: determine if house occupied by pinging a smartphone?

Thu Apr 28, 2016 3:03 pm

Many routers have a web page interface that can list all currently connected devices, but possibly also a connections log of previous connections. Therefore, you could possibly have a raspberry on that lan that runs a script that scrapes that page and then emails that data to you.

If the router runs dd-wrt or similar, it could be made to do it itsself

Return to “General discussion”