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

41 lines
873 B
Bash

#!/bin/bash
get_tool_name() {
echo "DNS Traffic Analyzer"
}
get_tool_description() {
echo "Analyze DNS traffic for 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"
dns_traffic=$(tcpdump -n -i any port 53 and host "$single_domain" -c 10)
if [ -n "$dns_traffic" ]; then
result+="\e[1mDNS Traffic:\e[0m\n$dns_traffic\n"
else
result+="\e[1mDNS Traffic:\e[0m No DNS traffic detected.\n"
fi
}