Created
March 28, 2024 08:51
-
-
Save mrasong/38f994c6c26d238eae4936289fb68f47 to your computer and use it in GitHub Desktop.
Query all unregistered domains
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DOMAIN=me # domain suffix | |
LENGTH=3 # length of domain | |
TIMEOUT="gtimeout 5" # timeout command, can be gtimeout or timeout or empty | |
MATCH_STRING="Domain not found" # unregisterd string | |
CHARS=(a b c d e f g h i j k l m n o p q r s t u v w x y z) | |
# CHARS=(a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9) | |
# CHARS=(0 1 2 3 4 5 6 7 8 9) | |
function find() { | |
if [[ $($TIMEOUT whois $1 | grep -i "$MATCH_STRING") ]]; then | |
echo $1 "available" | |
echo $1 >>$DOMAIN.txt | |
fi | |
} | |
function query() { | |
local len=$1 | |
local prefix=$2 | |
if [[ $len -gt 0 ]]; then | |
for i in ${CHARS[@]}; do | |
echo $prefix$i.$DOMAIN | |
query $(($len - 1)) $prefix$i | |
done | |
else | |
find $prefix.$DOMAIN | |
fi | |
} | |
query $LENGTH |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment