Skip to content

Instantly share code, notes, and snippets.

@altercation
Last active November 14, 2021 20:48
Show Gist options
  • Save altercation/4c16b557c294caec221d57177d98ed79 to your computer and use it in GitHub Desktop.
Save altercation/4c16b557c294caec221d57177d98ed79 to your computer and use it in GitHub Desktop.
Scanner to identify which of your basestations you are connected to for roaming fast switch analysis
#!/usr/bin/env sh
# macos base station scanner to analyze fast roaming, rssi, etc.
AIRPORT_CMD="/System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -I"
if [ "$(whoami)" != "root" ]
then
sudo "$0"
exit
fi
while true; do
#BS=$($AIRPORT_CMD | grep BSSID | sed -n -e 's/^.*BSSID: //p' | tr '[A-Z]' '[a-z]')
OUTPUT=$($AIRPORT_CMD)
BSSID=$(echo "$OUTPUT" | grep BSSID | sed -n -e 's/^.*BSSID: //p' | tr '[A-Z]' '[a-z]')
RSSI=$(echo "$OUTPUT" | grep agrCtlRSSI | sed -n -e 's/^.*RSSI: //p')
NOISE=$(echo "$OUTPUT" | grep agrCtlNoise | sed -n -e 's/^.*Noise: //p')
# change MAC addresses below to match your access point wireless MAC addresses
case $BSSID in
76:83:c2:9b:68:fb) BS=den ;;
7a:bc:de:f1:23:45) BS=kitchen ;;
7a:bc:de:f1:23:45) BS=bedroom ;;
7a:bc:de:f1:23:45) BS=porch ;;
7a:bc:de:f1:23:45) BS=basement ;;
*) BS="$BSSID (unknown)" ;;
esac
clear
echo "$BS ($RSSI/$NOISE)"
sleep 0.5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment