From e7299898533f5d40d24df7f0ced433d3ee16b039 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Sun, 14 Apr 2024 15:46:07 +0200 Subject: arp-ddns soweit fertig --- arp-ddns | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100755 arp-ddns diff --git a/arp-ddns b/arp-ddns new file mode 100755 index 0000000..e9e7ebf --- /dev/null +++ b/arp-ddns @@ -0,0 +1,38 @@ +#!/bin/bash + +cd "$(dirname "$(readlink -e "$0")")" + +. ./arp-ddns.conf + +echo nmap -sn $( + sipcalc $( + for dev in "${devs[@]}"; do + ip -4 -o addr show dev "$dev" + done \ + | awk '{print $4}' + ) \ + | awk ' + $1 == "Network" && $2 == "address" && $3 == "-" {print $4} + $1 == "Network" && $2 == "mask" && $3 == "(bits)" && $4 == "-" {print $5} + ' \ + | sed ' + N + s,\n,/, + ' +) >/dev/null + +join -1 1 -2 2 -o 1.2,2.1,1.3 <( + printf '%s\n' "${hosts[@]}" \ + | sort -k1,1 +) <( + arp -a \ + | cut -d' ' -f2,4 \ + | sort -k2,2 \ + | tr -d '()' +) \ +| while read -r host ip key; do + if dig +short ${host}.ddns.eckner.net A | grep -qxF "${ip}"; then + continue + fi + curl -Ss 'https://eckner.net/ddns.php?i='"${key}"'&address='"${ip}" +done -- cgit v1.2.3-70-g09d2