fix: 🐛 Use rdns instead of fdns to identify domain names
parent
76d6430303
commit
949bd7240c
|
@ -24,7 +24,8 @@ while IFS= read -r line; do
|
||||||
ipv6="$(<<<"${ips}" grep ':')"
|
ipv6="$(<<<"${ips}" grep ':')"
|
||||||
ipv4="${ipv4%%/*}"
|
ipv4="${ipv4%%/*}"
|
||||||
ipv6="${ipv6%%/*}"
|
ipv6="${ipv6%%/*}"
|
||||||
domain=$(<<<"${res}" grep -B1 " ${ipv4}$" | sed '/--/d' | awk '{print $2}' | paste -d " " - - | awk '{print $1}')
|
rev_ipv4="$(/usr/lib/wagon/ns_update_rev_ipv4 ${ipv4})"
|
||||||
|
domain=$(<<<"${res}" grep "^${rev_ipv4}\tname = " | sed 's/\.$//')
|
||||||
case "${format}" in
|
case "${format}" in
|
||||||
'json') printf '{"domain":"%s","ipv4":"%s","ipv6":"%s","pubkey":"%s"},' \
|
'json') printf '{"domain":"%s","ipv4":"%s","ipv6":"%s","pubkey":"%s"},' \
|
||||||
"${domain}" "${ipv4}" "${ipv6}" "${pubkey}";;
|
"${domain}" "${ipv4}" "${ipv6}" "${pubkey}";;
|
||||||
|
|
|
@ -13,13 +13,14 @@
|
||||||
|
|
||||||
source /etc/wagon/config
|
source /etc/wagon/config
|
||||||
|
|
||||||
res="$(/usr/lib/wagon/ns_lookup_send "-query=AXFR" "${TLD}.")"
|
rev_ipv4="$(/usr/lib/wagon/ns_update_rev_ipv4 ${IPV4_HUB} | cut -f1 | cut -d'.' -f3-6)"
|
||||||
|
res="$(/usr/lib/wagon/ns_lookup_rdns "-query=axfr" "${rev_ipv4}")"
|
||||||
case $? in
|
case $? in
|
||||||
0) printf '%s' "${res}"; exit 0;;
|
0) printf '%s' "${res}"; exit 0;;
|
||||||
4) printf 'Domain for %s not found!\n' "${1}" >&2; exit 4;;
|
4) printf 'Domain for %s not found!\n' "${1}" >&2; exit 4;;
|
||||||
5) printf 'Nameserver not available: %s\n' "${DNS_MASTER}" >&2; exit 5;;
|
5) printf 'Nameserver not available: %s\n' "${DNS_MASTER}" >&2; exit 5;;
|
||||||
6) printf 'nslookup not installed!\n' >&2; exit 6;;
|
6) printf 'nslookup not installed!\n' >&2; exit 6;;
|
||||||
8) printf 'nslookup threw an error!\n' >&2; exit 8;;
|
8) printf 'nslookup threw an error!\n' >&2; exit 8;;
|
||||||
9) printf 'nslookup refused RXFR request!\n' >&2; exit 7;;
|
9) printf 'nslookup refused AXFR request!\n' >&2; exit 7;;
|
||||||
*) printf 'Bad usage: %s %s\n' "${0}" "${@}" >&2; exit 3;;
|
*) printf 'Bad usage: %s %s\n' "${0}" "${@}" >&2; exit 3;;
|
||||||
esac
|
esac
|
||||||
|
|
Loading…
Reference in New Issue