bash-dns/tools/rdns_check.sh
2023-08-17 22:43:59 -05:00

42 lines
910 B
Bash

#!/bin/bash
get_tool_name() {
echo "RDNS Check"
}
get_tool_description() {
echo "Perform reverse DNS (RDNS) checks on a domain or domains"
}
execute_tool() {
result=""
if [ -n "$domain" ]; then
if [[ "$domain" == *$'\n'* ]]; then
for single_domain in $domain; do
process_domain "$single_domain"
done
else
process_domain "$domain"
fi
else
result="No domains specified."
fi
echo -e "$result"
}
process_domain() {
local single_domain="$1"
result+="\e[1mDomain:\e[93m $single_domain\e[0m\n"
single_domain_ip=$(dig A +short "$single_domain")
rDNS_result=$(dig +short -x "$single_domain_ip")
if [ -n "$rDNS_result" ]; then
result+="\e[1mRDNS Result:\e[32m $rDNS_result\n"
else
result+="\e[1mRDNS Result:\e[31m No RDNS record found.\n"
fi
}