Last active
June 11, 2017 23:07
-
-
Save salekseev/66a2fa4b9262eb80906026a6ee3dbbaa to your computer and use it in GitHub Desktop.
This file contains hidden or 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 | |
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