nsecx- NSEC[3] Walking for DNSSEC |
git clone git://git.acid.vegas/nsecx.git |
Log | Files | Refs | Archive | README | LICENSE |
tldsec (2385B)
1 #!/bin/sh 2 # NSEC Statistics for TLDs - developed by acidvegas (https://git.acid.vegas/nsecx) 3 # tldsec 4 5 # This script will check the DNSSEC status of all TLDs and output the results separated by NSEC, NSEC3, and NODNSSEC. 6 # NSEC3 records will also include the NSEC3PARAM parameters for the zone as well for cracking in Hashcat. 7 8 # ANSI color codes 9 RED='\033[0;31m' 10 GREEN='\033[0;32m' 11 YELLOW='\033[0;33m' 12 CYAN='\033[0;36m' 13 PURPLE='\033[0;35m' 14 GRAY='\033[1;30m' 15 NC='\033[0m' 16 17 # Create the output directory if it doesn't exist 18 mkdir -p output 19 20 # Parse the tld list from a root nameserver 21 tld_list=$(dig AXFR . @g.root-servers.net | grep -E 'IN\s+NS' | awk '{print $1}' | sed 's/\.$//' | sort -u) 22 23 # Get the total number of TLDs, excluding comments and empty lines 24 total_tlds=$(echo "$tld_list" | grep -v '^#' | grep -v '^$' | wc -l | tr -d ' ') 25 26 # Initialize TLD count 27 current_tld=0 28 nsec_total=0 29 nsec3_total=0 30 nodnssec_total=0 31 32 # Read through each TLD in the list 33 echo "$tld_list" | while read -r tld; do 34 35 # Increase TLD count 36 current_tld=$((current_tld + 1)) 37 38 # Convert TLD to lowercase using tr 39 tld=$(printf "%s" "$tld" | tr '[:upper:]' '[:lower:]') 40 41 # Check for DNSSEC records 42 output=$(dig +short ${tld}. DNSKEY) 43 44 if [ -z "$output" ]; then 45 nodnssec_total=$((nodnssec_total + 1)) 46 echo "$tld" >> output/nodnssec.txt 47 else 48 nsec_output=$(dig +short ${tld}. NSEC) 49 nsec3_output=$(dig +short ${tld}. NSEC3PARAM) 50 if [ -n "$nsec_output" ]; then 51 nsec_total=$((nsec_total + 1)) 52 echo "$tld" >> output/nsec.txt 53 elif [ -n "$nsec3_output" ]; then 54 nsec3_total=$((nsec3_total + 1)) 55 nsec3_params=$(echo "$nsec3_output" | awk '{print $1,$2,$3,$4}') 56 echo "${tld}:${nsec3_params}" >> output/nsec3.txt 57 else 58 nodnssec_total=$((nodnssec_total + 1)) 59 echo "$tld" >> output/nodnssec.txt 60 fi 61 fi 62 63 # Output the summarized status line with color 64 printf "\r${CYAN}%s/%s${NC} ${GRAY}|${NC} ${GREEN}NSEC: ${NC}%s ${GRAY}|${NC} ${YELLOW}NSEC3: ${NC}%s ${GRAY}|${NC} ${RED}NODNSSEC: ${NC}%s ${GRAY}|${NC} Checking ${PURPLE}%s${NC}... " \ 65 "$current_tld" "$total_tlds" \ 66 "$nsec_total" "$nsec3_total" "$nodnssec_total" "$tld" 67 done 68 69 echo "\nCheck completed! Data written to the output directory."