Skip to content

Instantly share code, notes, and snippets.

@drewsdesign
Created June 7, 2013 09:16
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save drewsdesign/5728068 to your computer and use it in GitHub Desktop.
Save drewsdesign/5728068 to your computer and use it in GitHub Desktop.
Tracking with wifi and a mac address
#!/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