Make domain searching more robust and accurate

This commit is contained in:
Salt 2020-02-23 01:33:53 -06:00
parent 0c27b42700
commit 606779e8e1

View File

@ -82,8 +82,10 @@ checkavaildomains() {
[ -z "$1" ] && return 1 [ -z "$1" ] && return 1
# Strip leading periods # Strip leading periods
tld="${1#.}" tld="${1#.}"
tldstrip="${tld//\./}" # Looking at you, .co.in
while read word; do while read word; do
! [[ $word == *$tld ]] && continue ! [[ $word == *$tldstrip ]] && continue
[[ $word == $tldstrip ]] && continue # Ignore the tld itself
log "Processing word: $word" 2 log "Processing word: $word" 2
prefix="${word%$tld}" prefix="${word%$tld}"
fqdn="$prefix.$tld" fqdn="$prefix.$tld"