Skip to content

Instantly share code, notes, and snippets.

@rudolfschmidt
Created June 2, 2020 21:04
Show Gist options
  • Save rudolfschmidt/b79b7864bac19cc7148edf6dc978c284 to your computer and use it in GitHub Desktop.
Save rudolfschmidt/b79b7864bac19cc7148edf6dc978c284 to your computer and use it in GitHub Desktop.
Check Free 3 Letter Domains
#!/usr/bin/env bash
array=( 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 )
for a in "${array[@]}"
do
for b in "${array[@]}"
do
for c in "${array[@]}"
do
domain="$a$b$c.de"
echo $domain
nslookup $domain|grep NXDOMAIN >> free.txt
done
done
done
@gabrielsroka
Copy link

or

#!/usr/bin/env bash

# Set this:
tld=.de

for a in {a..z}
do
	for b in {a..z}
	do
		for c in {a..z}
		do
			domain="$a$b$c$tld"
			echo $domain
			nslookup $domain|grep NXDOMAIN >> free.txt
		done
	done
done

@parasense
Copy link

parasense commented Feb 2, 2022

You might shorten the script with bash's built-in brace expansion.
For example:

#!/bin/bash

tld='de'
for name in {a..z}{a..z}{a..z}.$tld
do	
  dig +short $name soa | grep -qv "^$" || printf "$name\n" | tee -a free.txt
done

EDIT: and, if you wanted to include digits...

tld='de'
for name in {{a..z},{0..9}}{{a..z},{0..9}}{{a..z},{0..9}}.${tld}
do	
  dig +short $name soa | grep -qv "^$" || printf "$name\n" | tee -a free.txt
done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment