Last active
January 8, 2017 12:54
-
-
Save marcohald/8553980f9ec3f3d3aae84b7cdefca831 to your computer and use it in GitHub Desktop.
Script to monitor alfred Announcements
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 | |
#Define the IPv6 Link Local addresses of the known Alfred Masters | |
masters="fe80::ff:feee:1 fe80::ff:feee:3" | |
if [ "$1" != "" ]; then | |
interface="$1" | |
else | |
echo "Please provide an interface for tcpdump as argument." | |
echo "For Example bat0" | |
exit | |
fi | |
tcpdump -i $interface -l ip6 multicast and udp and port 16962 and ether[62:1] = 0x01 | awk '{print $3}' | awk -F '.' '{print $1}' | while read linklocal; do | |
masterfound=0 | |
for master in $masters | |
do | |
if [ "$linklocal" = "$master" ]; then | |
echo "$linklocal is in the list of masters $masters" | |
masterfound=1 | |
break | |
fi | |
done | |
if [ ! $masterfound ]; then | |
echo "Undefined Master $linklocal on $interface should be one of $masters" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment