Skip to content

Instantly share code, notes, and snippets.

@salekseev
Last active June 11, 2017 23:07
Show Gist options
  • Save salekseev/66a2fa4b9262eb80906026a6ee3dbbaa to your computer and use it in GitHub Desktop.
Save salekseev/66a2fa4b9262eb80906026a6ee3dbbaa to your computer and use it in GitHub Desktop.
#!/bin/sh
while true
do
all=""
for interface in $(dmesg | grep ^eth | grep 802.11 | cut -s -d: -f1)
do
# for each interface, get mac addresses of connected stations/clients
maclist=$(wl -i $interface assoclist | cut -s -d" " -f2 | xargs -n 1 wl -i $interface sta_info | grep STA | cut -s -d" " -f3 | sed 's/.$//')
# for each mac address in that list...
for mac in $maclist
do
if [ -z $all ]; then
all=$mac
else
all="$all\n$mac"
fi
done
done
if [ ! -z $all ]; then
echo -e $all > /tmp/presence.wifi
fi
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment