A script to query all unregistered domains.

Blow is a demo to query all 3 letter .me domain. You can modify it to your needs.

 1#!/bin/bash
 2DOMAIN=me                       # domain suffix
 3LENGTH=3                        # length of domain
 4TIMEOUT="gtimeout 5"            # timeout command, can be gtimeout or timeout or empty
 5MATCH_STRING="Domain not found" # unregisterd string
 6CHARS=(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)
 7# 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)
 8# CHARS=(0 1 2 3 4 5 6 7 8 9)
 9
10function find() {
11    if [[ $($TIMEOUT whois $1 | grep -i "$MATCH_STRING") ]]; then
12        echo $1 "available"
13        echo $1 >>$DOMAIN.txt
14    fi
15}
16
17function query() {
18    local len=$1
19    local prefix=$2
20
21    if [[ $len -gt 0 ]]; then
22        for i in ${CHARS[@]}; do
23            echo $prefix$i.$DOMAIN
24            query $(($len - 1)) $prefix$i
25        done
26    else
27        find $prefix.$DOMAIN
28    fi
29}
30
31query $LENGTH

Gist link