butterknife-provisioning-image/overlay/sbin/butterknife-discover
2021-02-23 00:32:51 +02:00

13 lines
473 B
Plaintext
Executable File

dig -t ANY @224.0.0.251 -p5353 +noall +answer _butterknife._tcp.local | grep "IN SRV" | while read line; do
hostname=$(echo $line | cut -d " " -f 8)
address=$(dig +short +noall +answer @224.0.0.251 -p5353 $hostname | head -n1)
port=$(echo $line | cut -d " " -f 7)
title=$(echo $line | cut -d "." -f 1 | sed -e 's/\032/ /g')
if [ $port -eq 80 ]; then
echo "http://$address \"$title\""
else
echo "http://$address:$port \"$title\""
fi
done