bash-dns/wip/cache_poison_test.sh.unloaded
2023-08-17 18:07:49 -05:00

42 lines
956 B
Bash

#!/bin/bash
get_tool_name() {
echo "DNS Cache Poisoning Tester"
}
get_tool_description() {
echo "Test DNS cache poisoning vulnerability 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[0m $single_domain\n"
ns1_result=$(dig +short @"$single_domain" "$single_domain")
ns2_result=$(dig +short @"$single_domain" "$single_domain")
if [ "$ns1_result" == "$ns2_result" ]; then
result+="\e[1mCache Poisoning:\e[0m Vulnerable\n"
else
result+="\e[1mCache Poisoning:\e[0m Not Vulnerable\n"
fi
}