Skip to content

Instantly share code, notes, and snippets.

@neoneye
Created March 14, 2024 15:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neoneye/934b23d976bd462faaedb32265867eee to your computer and use it in GitHub Desktop.
Save neoneye/934b23d976bd462faaedb32265867eee to your computer and use it in GitHub Desktop.
Find available domain names by combining words

Prerequisits

PROMPT> python3 -m venv venv
PROMPT> source venv/bin/activate
(venv) PROMPT> pip install python-whois
(venv) PROMPT> pip install tqdm

run

python3 main.py
Available: paper-game.com                                                                                                                                                                                                                            
Available: paper-puzzle.com                                                                                                                                                                                                                          
Available: rock-puzzle.com                                                                                                                                                                                                                           
from tqdm import tqdm
import whois
import csv
# Base parts of the names to combine
base_parts = [
'paper', 'rock', 'scissors',
]
# Suffixes to append
suffixes = ['game', 'puzzle']
# Generate combinations
names_to_check = []
for base in base_parts:
for suffix in suffixes:
# Without dash
names_to_check.append(f"{base}{suffix}.com")
# With dash
names_to_check.append(f"{base}-{suffix}.com")
for base1 in base_parts:
for base2 in base_parts:
for suffix in suffixes:
# Without dash
names_to_check.append(f"{base1}{base2}{suffix}.com")
# With dash
names_to_check.append(f"{base1}-{base2}-{suffix}.com")
# Check each domain for availability
available_domains = []
for name in tqdm(names_to_check, desc="Checking domains"):
try:
w = whois.whois(name)
except Exception as e:
tqdm.write(f"Available: {name}")
available_domains.append(name)
# Save available domains to a CSV file
filename = "available_domains.csv"
with open(filename, 'w', newline='') as csvfile:
domainwriter = csv.writer(csvfile)
domainwriter.writerow(['Available Domains'])
for domain in available_domains:
domainwriter.writerow([domain])
print(f"Available domains saved to {filename}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment