"
}
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""@""
O
"
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""@""
O
"
Red="1"
else
Entry="$Entry""@""
O
"
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""@""
O
"
Red="1"
else
Entry="$Entry""@""
O
"
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""@""
O-NAT?
"
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 ""
echo ""
RedIE="$Red"
if [ -n "$FirstSerialInt" ]; then
Tmp="$(
echo "