455 lines
16 KiB
Bash
Executable File
455 lines
16 KiB
Bash
Executable File
#!/bin/sh
|
|
|
|
. /etc/ffdns/community.conf
|
|
. /etc/ffdns/local.conf
|
|
. /usr/lib/ffdns/dns-functions.sh
|
|
|
|
InternalIPv4=""
|
|
InternalIPv4GU=""
|
|
ExternalIPv4=""
|
|
InternalIPv6ULA=""
|
|
InternalIPv6GU=""
|
|
ExternalIPv6=""
|
|
|
|
Destination="/wwwcommon/ffdns/monitor.html"
|
|
|
|
if [ -n "$CommunityExternPrefix" ];then
|
|
MasterExternDomain="$CommunityExternPrefix"".""$CommunityDomain"
|
|
fi
|
|
|
|
curl -s -S -f "$RemoteLocation""db.""$CommunityDomain" --output "$TempFolder""ffdnsstatusmaster"
|
|
|
|
HiddenServers="$(GetAllZoneNameservers "$CommunityDomain" "$TempFolder""ffdnsstatusmaster")"
|
|
FirstLocal="$(sed -e '/^[^;]*\s\(10\.\|[fF][cdCD][0-9a-fA-F]\{2\}:\)\S*\s*.*/!d;q' "$TempFolder""ffdnsstatusmaster" | sed -e 's/\s.*//g;s/\([^.]\)$/\1\.'"$(SEDifyHostname "$CommunityDomain")"'/g')"
|
|
MasterSerial="$(GetZoneFileSerial "$TempFolder""ffdnsstatusmaster")"
|
|
|
|
CommunityTLD="$(echo "$CommunityDomain" | sed -ne 's/^[^.]\+\.\(.*\)$/\1/p')"
|
|
[ -n "$CommunityTLD" ] || CommunityTLD="."
|
|
TLDServer="$(dig "$CommunityTLD" -t NS 2>/dev/null | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+\NS\s\+\(\S\+\)$/\1/p' | sed 1!d)"
|
|
[ -n "$TLDServer" ] || Error="No TLD-Server"
|
|
AdditionalServers="$(cat /etc/scripts/AddServers)"
|
|
|
|
if [ -z "$Error" ]; then
|
|
dig @"$TLDServer" "$CommunityDomain" -t NS 2>/dev/null | sort > "$TempFolder""ffdnsstatus"
|
|
TopMasterServers="$(GetAllZoneNameservers "$CommunityDomain" "$TempFolder""ffdnsstatus")"
|
|
for MasterServer in $TopMasterServers; do
|
|
HiddenServers="$(echo "$HiddenServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/d' | sort)"
|
|
done
|
|
fi
|
|
|
|
GetIPEntry() {
|
|
sed -ne 's/^'"$MasterServer"'\.\s\+\S\+\s\+IN\s\+\(A\|AAAA\)\s\+\(\S\+\)$/\2/p'
|
|
}
|
|
GetIPs() {
|
|
dig "$MasterServer" -t A 2>/dev/null | GetIPEntry | sort -n
|
|
dig "$MasterServer" -t AAAA 2>/dev/null | GetIPEntry | sort -n
|
|
}
|
|
GetDNSSECTable() {
|
|
echo "<table>"
|
|
echo -n "<tr><th>DNSSEC</th><th>""$1""</th></tr>"
|
|
dig +timeout=2 @"$MasterServer" _dnsseckeys."$1" -t TXT 2>/dev/null | \
|
|
sed -ne 's/^\S\+\s\+\S\+\s\+IN\s\+TXT\s\+\"\(.*\)\"$/<tr><th>own key<\/th><th>\1<\/th><\/tr>/p' | \
|
|
sort
|
|
dig +timeout=2 @"$MasterServer" "$1" -t DNSKEY 2>/dev/null | \
|
|
sed -ne 's/^\S\+\s\+\S\+\s\+IN\s\+DNSKEY\s\+\(.*\)$/<tr><th>all keys<\/th><th>\1<\/th><\/tr>/p' | \
|
|
sort
|
|
echo "</table></br>"
|
|
}
|
|
HasRAFlag() {
|
|
[ -n "$(echo "$1" | sed -e '/^;; flags:[^;]*\s\+ra\(\s\|;\)/!d')" ] && echo "+ra"
|
|
}
|
|
HasAAFlag() {
|
|
[ -n "$(echo "$1" | sed -e '/;; flags:[^;]*\s\+aa\(\s\|;\)/!d')" ] && echo "1"
|
|
}
|
|
GetServerTable() {
|
|
if [ -z "$2" ]; then
|
|
Color="1C8000"
|
|
elif [ "$2" = "stealth" ]; then
|
|
Color="96A300"
|
|
elif [ "$2" = "other" ]; then
|
|
Color="00A276"
|
|
else
|
|
Color="801C88"
|
|
fi
|
|
if [ -z "$2" ]; then
|
|
AllIPs="$(cat "$TempFolder""ffdnsstatus" | GetIPEntry | sed -e 's/$/@✓@/g')"
|
|
else
|
|
AllIPs=""
|
|
fi
|
|
AARR=""
|
|
Authoritative=""
|
|
GlueIPs="$(GetIPs)"
|
|
for IP in $GlueIPs; do
|
|
if [ -n "$( echo "$AllIPs" | sed -e '/'"$(SEDifyHostname "$IP")"'/!d')" ]; then
|
|
AllIPs="$(echo "$AllIPs" | sed -e '/'"$(SEDifyHostname "$IP")"'/s/@$/@✓/g')"
|
|
AARR="1"
|
|
elif [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
AllIPs="$(echo "$AllIPs"; echo "$IP""@@✓")"
|
|
AARR="1"
|
|
else
|
|
AllIPs="$(echo "$AllIPs"; echo "$IP""@@")"
|
|
fi
|
|
done
|
|
if [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
AllIPs="$(echo "$AllIPs" | sed -e 's/^\(.*@\)$/\1X/g')"
|
|
fi
|
|
for IP in $3; do
|
|
if [ -z "$( echo "$AllIPs" | sed -e '/'"$(SEDifyHostname "$IP")"'/!d')" ]; then
|
|
AllIPs="$(echo "$AllIPs"; echo "$IP""@@")"
|
|
fi
|
|
done
|
|
|
|
AllIPs="$(echo "$AllIPs" | sed -e '/^$/d')"
|
|
|
|
Orange=""
|
|
Red=""
|
|
RedIE=""
|
|
AllEntries=""
|
|
FirstAnswerInt=""
|
|
FirstAnswerExt=""
|
|
FirstSerialInt=""
|
|
FirstSerialExt=""
|
|
for Entry in $AllIPs; do
|
|
IP="$(echo "$Entry" | sed -ne 's/^\([^@]*\).*/\1/p')"
|
|
if IsValidIPv4 "$IP"; then
|
|
OwnInternULA="$InternalIPv4"
|
|
OwnInternGU="$InternalIPv4GU"
|
|
OwnExtern="$ExternalIPv4"
|
|
IsGlobal="$( echo "$IP" | sed -ne 's/^10\..*/1/p')"
|
|
IsIPv4="1"
|
|
else
|
|
OwnInternULA="$InternalIPv6ULA"
|
|
OwnInternGU="$InternalIPv6GU"
|
|
OwnExtern="$ExternalIPv6"
|
|
IsGlobal="$( echo "$IP" | sed -ne 's/^[fF][cdCD][0-9a-fA-F]\{2\}:.*/1/p')"
|
|
IsIPv4=""
|
|
fi
|
|
if [ -z "$IsGlobal" ]; then
|
|
CurAnswer="$(dig +timeout=2 @"$IP" +notcp +nsid "$CommunityDomain" -b "$OwnExtern" -t SOA 2>/dev/null)"
|
|
Serial="$( echo "$CurAnswer" | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+\s\+\S\+\s\+\(\S\+\).*/\1/p')"
|
|
if [ -n "$Serial" ]; then
|
|
[ -n "$FirstSerialExt" ] || FirstSerialExt="$Serial" && FirstAnswerExt="$CurAnswer"
|
|
Authoritative="$(HasAAFlag "$CurAnswer")"
|
|
Entry="$Entry""@✓""$(HasRAFlag "$CurAnswer")"
|
|
elif [ -n "$AARR" ]; then
|
|
Entry="$Entry""@X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ -n "$OwnInternGU" ]; then
|
|
CurAnswer="$(dig +timeout=2 @"$IP" +notcp +nsid "$CommunityDomain" -b "$OwnInternGU" -t SOA 2>/dev/null)"
|
|
Serial="$( echo "$CurAnswer" | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+\s\+\S\+\s\+\(\S\+\).*/\1/p')"
|
|
if [ -n "$Serial" ]; then
|
|
Entry="$Entry""@""✓""$(HasRAFlag "$CurAnswer")"
|
|
elif [ -n "$AARR" ]; then
|
|
Entry="$Entry""@""X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ "$IP" != "$ExternalIPv4" ] && [ "$IP" != "$ExternalIPv6" ]; then
|
|
CurAnswer="$(dig +timeout=2 @"$IP" +notcp +nsid "$CommunityDomain" -b "$OwnInternULA" -t SOA 2>/dev/null)"
|
|
else
|
|
CurAnswer=""
|
|
fi
|
|
Serial="$( echo "$CurAnswer" | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+\s\+\S\+\s\+\(\S\+\).*/\1/p')"
|
|
if [ -n "$Serial" ]; then
|
|
[ -n "$FirstSerialInt" ] || FirstSerialInt="$Serial" && FirstAnswerInt="$CurAnswer"
|
|
Entry="$Entry""@""✓""$(HasRAFlag "$CurAnswer")"
|
|
elif [ -n "$IsGlobal" ]; then
|
|
Entry="$Entry""@""X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ -z "$IsGlobal" ]; then
|
|
CurAnswer="$(dig +timeout=2 @"$IP" +tcp +nsid "$CommunityDomain" -b "$OwnExtern" -t SOA 2>/dev/null)"
|
|
Serial="$( echo "$CurAnswer" | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+\s\+\S\+\s\+\(\S\+\).*/\1/p')"
|
|
if [ -n "$Serial" ]; then
|
|
[ -n "$FirstSerialExt" ] || FirstSerialExt="$Serial" && FirstAnswerExt="$CurAnswer"
|
|
Entry="$Entry""@""✓""$(HasRAFlag "$CurAnswer")"
|
|
elif [ -n "$AARR" ]; then
|
|
Entry="$Entry""@""X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ -n "$OwnInternGU" ]; then
|
|
CurAnswer="$(dig +timeout=2 @"$IP" +tcp +nsid "$CommunityDomain" -b "$OwnInternGU" -t SOA 2>/dev/null)"
|
|
Serial="$( echo "$CurAnswer" | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+\s\+\S\+\s\+\(\S\+\).*/\1/p')"
|
|
if [ -n "$Serial" ]; then
|
|
Entry="$Entry""@""✓""$(HasRAFlag "$CurAnswer")"
|
|
elif [ -n "$AARR" ]; then
|
|
Entry="$Entry""@""X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ "$IP" != "$ExternalIPv4" ] && [ "$IP" != "$ExternalIPv6" ]; then
|
|
CurAnswer="$(dig +timeout=2 @"$IP" +tcp +nsid "$CommunityDomain" -b "$OwnInternULA" -t SOA 2>/dev/null)"
|
|
else
|
|
CurAnswer=""
|
|
fi
|
|
Serial="$( echo "$CurAnswer" | sed -ne 's/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+\s\+\S\+\s\+\(\S\+\).*/\1/p')"
|
|
if [ -n "$Serial" ]; then
|
|
[ -n "$FirstSerialInt" ] || FirstSerialInt="$Serial" && FirstAnswerInt="$CurAnswer"
|
|
Entry="$Entry""@""✓""$(HasRAFlag "$CurAnswer")"
|
|
elif [ -n "$IsGlobal" ]; then
|
|
Entry="$Entry""@""X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
|
|
if [ -z "$IsGlobal" ] && [ -n "$(dig +timeout=2 @"$IP" google.com -b "$OwnExtern" -t SOA 2>/dev/null | sed -e '/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+.*/!d')" ]; then
|
|
Entry="$Entry""@""<p style=\"color:#FA8D07\">O</p>"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
|
|
if [ -n "$OwnInternGU" ] && [ -n "$(dig +timeout=2 @"$IP" google.com -b "$OwnInternGU" -t SOA 2>/dev/null | sed -e '/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+.*/!d')" ]; then
|
|
Entry="$Entry""@""✓"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ "$IP" != "$ExternalIPv4" ] && [ "$IP" != "$ExternalIPv6" ] && [ -n "$(dig +timeout=2 @"$IP" google.com -b "$OwnInternULA" -t SOA 2>/dev/null | sed -e '/^[^;]\S*\s\+\S\+\s\+IN\s\+SOA\s\+\S\+.*/!d')" ]; then
|
|
Entry="$Entry""@""✓"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
|
|
|
|
if [ -z "$FirstLocal" ]; then
|
|
Entry="$Entry""@?@?"
|
|
else
|
|
if [ -z "$IsGlobal" ] && [ -n "$(dig +timeout=2 @"$IP" "$FirstLocal" -b "$OwnExtern" -t ANY 2>/dev/null | sed -e '/^[^;]*\s\(10\.\|[fF][cdCD][0-9a-fA-F]\{2\}:\)\S*\s*.*/!d')" ]; then
|
|
if [ -n "$Authoritative" ]; then
|
|
Entry="$Entry""@""<p style=\"color:#FF0000\">O</p>"
|
|
Red="1"
|
|
else
|
|
Entry="$Entry""@""<p style=\"color:#FA8D07\">O</p>"
|
|
fi
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ -n "$OwnInternGU" ] && [ -n "$(dig +timeout=2 @"$IP" "$FirstLocal" -b "$OwnInternGU" -t ANY 2>/dev/null | sed -e '/^[^;]*\s\(10\.\|[fF][cdCD][0-9a-fA-F]\{2\}:\)\S*\s*.*/!d')" ]; then
|
|
if [ -z "$IsGlobal" ]; then
|
|
if [ -n "$Authoritative" ]; then
|
|
Entry="$Entry""@""<p style=\"color:#FF0000\">O</p>"
|
|
Red="1"
|
|
else
|
|
Entry="$Entry""@""<p style=\"color:#FA8D07\">O</p>"
|
|
fi
|
|
else
|
|
Entry="$Entry""@""✓"
|
|
fi
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
if [ "$IP" != "$ExternalIPv4" ] && [ -n "$(dig +timeout=2 @"$IP" "$FirstLocal" -b "$OwnInternULA" -t ANY 2>/dev/null | sed -e '/^[^;]*\s\(10\.\|[fF][cdCD][0-9a-fA-F]\{2\}:\)\S*\s*.*/!d')" ]; then
|
|
if [ -z "$IsGlobal" ] && [ -n "$IsIPv4" ]; then
|
|
Entry="$Entry""@""<p style=\"color:#FA8D07\">O-NAT?</p>"
|
|
else
|
|
Entry="$Entry""@""✓"
|
|
fi
|
|
elif [ -n "$IsGlobal" ]; then
|
|
Entry="$Entry""@""X"
|
|
else
|
|
Entry="$Entry""@"
|
|
fi
|
|
fi
|
|
AllEntries="$(echo "$AllEntries"; echo "$Entry")"
|
|
done
|
|
|
|
[ -z "$(echo "$AllEntries" | sed -e '/X/!d')" ] || Red="1"
|
|
|
|
echo "</br>"
|
|
echo "</br>"
|
|
|
|
RedIE="$Red"
|
|
if [ -n "$FirstSerialInt" ]; then
|
|
Tmp="$(
|
|
echo "<table>"
|
|
echo "<tr><th>Intern</th></tr>"
|
|
echo -n "<tr><th")"
|
|
if [ $((FirstSerialInt)) -lt $((MasterSerial)) ]; then
|
|
Tmp="$Tmp"" style=\"color:#FF0000\">Serial</th><th>""$FirstSerialInt"
|
|
Red="1"
|
|
else
|
|
Tmp="$Tmp"">Serial</th><th>""$FirstSerialInt"
|
|
fi
|
|
Tmp="$(echo "$Tmp""</th></tr>"
|
|
echo -n "<tr><th")"
|
|
if [ -z "$( echo "$FirstAnswerInt" | sed -e '/;; flags:[^;]*\s\+aa\s\+/!d')" ]; then
|
|
if [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
Tmp="$Tmp"" style=\"color:#FF0000\">Authoritative</th><th>X"
|
|
RedIE="1"
|
|
else
|
|
Tmp="$Tmp"">Authoritative</th><th>"
|
|
fi
|
|
else
|
|
Authoritative="1"
|
|
if [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
Tmp="$Tmp"">Authoritative</th><th>✓"
|
|
else
|
|
Tmp="$Tmp"" style=\"color:#FA8D07\">Authoritative</th><th>✓"
|
|
fi
|
|
fi
|
|
Tmp="$(echo "$Tmp""</th></tr>"
|
|
echo -n "<tr><th>NSID</th><th>"
|
|
echo "$FirstAnswerInt" | sed -ne 's/; NSID:.*(\"\(.*\)\")$/\1/p'
|
|
echo "</th></tr>"
|
|
echo -n "<tr><th>dns-script</th><th>"
|
|
dig +timeout=2 @"$MasterServer" _dnsscript_version."$CommunityDomain" -t TXT 2>/dev/null | \
|
|
sed -ne 's/^\S\+\s\+\S\+\s\+IN\s\+TXT\s\+\"\(.\+\)\"$/\1/p'
|
|
echo "</th></tr>"
|
|
echo -n "<tr><th>Version.Bind</th><th>"
|
|
dig +timeout=2 @"$MasterServer" version.bind chaos -t TXT 2>/dev/null | \
|
|
sed -ne 's/^\S\+\s\+\S\+\s\+CH\s\+TXT\s\+\"\(.\+\)\"$/\1/p'
|
|
echo "</th></tr>"
|
|
echo "</table></br>")"
|
|
else
|
|
RedIE="1"
|
|
fi
|
|
|
|
if [ -n "$FirstSerialExt" ]; then
|
|
Tmp="$( echo "$Tmp"
|
|
echo "<table>"
|
|
echo "<tr><th>Extern</th></tr>"
|
|
echo -n "<tr><th")"
|
|
if [ $((FirstSerialExt)) -lt $((MasterSerial)) ]; then
|
|
Tmp="$Tmp"" style=\"color:#FF0000\">Serial</th><th>""$FirstSerialExt"
|
|
Red="1"
|
|
else
|
|
Tmp="$Tmp"">Serial</th><th>""$FirstSerialExt"
|
|
fi
|
|
Tmp="$(echo "$Tmp""</th></tr>"
|
|
echo -n "<tr><th")"
|
|
if [ -z "$( echo "$FirstAnswerExt" | sed -e '/;; flags:[^;]*\s\+aa\s\+/!d')" ]; then
|
|
if [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
Tmp="$Tmp"" style=\"color:#FF0000\">Authoritative</th><th>X"
|
|
RedIE="1"
|
|
else
|
|
Tmp="$Tmp"">Authoritative</th><th>"
|
|
fi
|
|
else
|
|
Authoritative="1"
|
|
if [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
Tmp="$Tmp"">Authoritative</th><th>✓"
|
|
else
|
|
Tmp="$Tmp"" style=\"color:#FA8D07\">Authoritative</th><th>✓"
|
|
fi
|
|
fi
|
|
Tmp="$(echo "$Tmp""</th></tr>"
|
|
echo -n "<tr><th>NSID</th><th>"
|
|
echo "$FirstAnswerExt" | sed -ne 's/; NSID:.*(\"\(.*\)\")$/\1/p'
|
|
echo "</th></tr>"
|
|
echo -n "<tr><th>dns-script</th><th>"
|
|
dig +timeout=2 @"$MasterServer" _dnsscript_version."$CommunityDomain" -t TXT 2>/dev/null | \
|
|
sed -ne 's/^\S\+\s\+\S\+\s\+IN\s\+TXT\s\+\"\(.\+\)\"$/\1/p'
|
|
echo "</th></tr>"
|
|
echo -n "<tr><th>Version.Bind</th><th>"
|
|
dig +timeout=2 @"$MasterServer" version.bind chaos -t TXT 2>/dev/null | \
|
|
sed -ne 's/^\S\+\s\+\S\+\s\+CH\s\+TXT\s\+\"\(.\+\)\"$/\1/p'
|
|
echo "</th></tr>"
|
|
echo "</table></br>")"
|
|
else
|
|
RedIE="1"
|
|
fi
|
|
|
|
if [ -z "$2" ] || [ "$2" = "stealth" ]; then
|
|
[ -n "$Red" ] || Red="$RedIE"
|
|
fi
|
|
|
|
if [ -n "$Red" ]; then
|
|
Color="FF0000"
|
|
elif [ -n "$Orange" ]; then
|
|
Color="FA8D07"
|
|
fi
|
|
echo -n "<h2 style=\"color:""$Color""\""
|
|
|
|
echo -n ">""$MasterServer"
|
|
[ -z "$2" ] || echo -n " (""$2"")"
|
|
echo "</h2>"
|
|
|
|
echo "$Tmp"
|
|
Tmp=""
|
|
|
|
if [ -n "$Authoritative" ]; then
|
|
GetDNSSECTable "$CommunityDomain"
|
|
|
|
[ -z "$MasterExternDomain" ] || GetDNSSECTable "$MasterExternDomain"
|
|
fi
|
|
|
|
echo "<table>"
|
|
echo "<tr><th>IP</th><th>glue RR</th><th>AA RR</th><th>UDP</br>+ra flag</br>ext</th><th>UDP</br>+ra flag</br>int GU</th><th>UDP</br>+ra flag</br>int ULA</th><th>TCP</br>+ra flag</br>ext</th><th>TCP</br>+ra flag</br>int GU</th><th>TCP</br>+ra flag</br>int ULA</th><th>recursion</br>ext</th><th>recursion</br>int GU</th><th>recursion</br>int ULA</th><th>serving</br>local IPs</br>ext</th><th>serving</br>local IPs</br>int GU</th><th>serving</br>local IPs</br>int ULA</th></tr>"
|
|
echo "$AllEntries" | sed -e 's/^\(.*X.*\)$/<tr style=\"color:#FF0000\"><th>\1/g;s/^\([^<].*#FF0000\">O.*\)$/<tr style=\"color:#FF0000\"><th>\1/g;s/^\([^<].*\([^>]O\|O[^-]\).*\)$/<tr style=\"color:#DE7C04\"><th>\1/g;s/^\([^<]\)/<tr><th>\1/g;s/@/<\/th><th>/g;s/$/<\/th><\/tr>/g'
|
|
echo "</table>"
|
|
}
|
|
|
|
if [ -z "$Error" ]; then
|
|
{
|
|
echo "<html xmlns=\"http://www.w3.org/1999/xhtml\">"
|
|
echo "<head>"
|
|
echo " <meta http-equiv=\"content-type\" content=\"text/html; charset=utf-8\" />"
|
|
echo " <title>DNS-Monitor</title>"
|
|
echo " <link href=\"/style.css\" rel=\"stylesheet\" type=\"text/css\" media=\"screen\" />"
|
|
echo " <meta http-equiv=\"cache-control\" content=\"no-cache\" />"
|
|
echo " <meta http-equiv=\"pragma\" content=\"no-cache\" />"
|
|
echo " <meta http-equiv=\"expires\" content=\"0\" />"
|
|
echo " <style>"
|
|
echo " table {"
|
|
echo " font-family: monospace, sans-serif;"
|
|
echo " border-collapse: collapse;"
|
|
echo " }"
|
|
echo " td, th {"
|
|
echo " border: 1px solid #fddddd;"
|
|
echo " text-align: left;"
|
|
echo " padding: 1px;"
|
|
echo " padding-right: 10px;"
|
|
echo " }"
|
|
echo " tr:nth-child(even) {"
|
|
echo " background-color: #dddddd;"
|
|
echo " }"
|
|
echo " </style>"
|
|
echo "</head>"
|
|
echo "<body>"
|
|
echo "<h1>Freifunk-Franken DNS-Monitor</h1>"
|
|
|
|
echo "<h7>Last Updated ""$(date)""</h7><br />"
|
|
for MasterServer in $TopMasterServers; do
|
|
AddIP=""
|
|
if [ -n "$(echo "$AdditionalServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/!d')" ]; then
|
|
AddIP="$(echo "$AdditionalServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/!d;s/^[^ ]*\( \)\?//g')"
|
|
AdditionalServers="$(echo "$AdditionalServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/d')"
|
|
fi
|
|
GetServerTable "$MasterServer" "" "$AddIP"
|
|
done
|
|
for MasterServer in $HiddenServers; do
|
|
AddIP=""
|
|
if [ -n "$(echo "$AdditionalServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/!d')" ]; then
|
|
AddIP="$(echo "$AdditionalServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/!d;s/^[^ ]*\( \)\?//g')"
|
|
AdditionalServers="$(echo "$AdditionalServers" | sed -e '/'"$(SEDifyHostname "$MasterServer")"'/d')"
|
|
fi
|
|
GetServerTable "$MasterServer" "stealth"
|
|
done
|
|
AdditionalServers="$(echo "$AdditionalServers" | sed -e 's/ /#/g')"
|
|
for ServerEntry in $AdditionalServers; do
|
|
MasterServer="$(echo "$ServerEntry" | sed -e 's/#.*//g')"
|
|
GetServerTable "$MasterServer" "other" "$(echo "$ServerEntry" | sed -e 's/^[^#]*\(#\)\?//g;s/#/ /g')"
|
|
done
|
|
echo "</body>"
|
|
echo "</html>"
|
|
} > "$TempFolder""ffdnsmonitor.html"
|
|
mv -f "$TempFolder""ffdnsmonitor.html" "$Destination"
|
|
fi
|
|
|
|
|
|
rm -f "$TempFolder""ffdnsstatusmaster" |