Created
June 7, 2013 09:16
-
-
Save drewsdesign/5728068 to your computer and use it in GitHub Desktop.
Tracking with wifi and a mac address
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
client="E0:F8:47:86:01:C2" #iPhone | |
logfile="/jffs/wifilog-$(date +"%m%d")-$client.log" | |
assoclist=$(wl assoclist | grep $client) | |
notconnmsg="$(date +"%T") Disconnected" | |
connmsg="$(date +"%T") Connected" | |
if [ ! -f $logfile ]; then | |
echo $notconnmsg > $logfile | |
fi | |
if [ -z $assoclist ]; then # Client is not connected | |
echo $(tail -n 1 $logfile) - $notconnmsg | |
if [ -z $(tail -n 1 $logfile | grep "Disconnected") ]; then # Last log is connected show not connected message | |
echo $notconnmsg >> $logfile | |
fi | |
else # Client is connected | |
echo $(tail -n 1 $logfile) - $connmsg | |
if [ -z $(tail -n 1 $logfile | grep "Connected") ]; then # Last log is not connected show connected message | |
echo $connmsg >> $logfile | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment