RSS Amplifier

Eiko Wagenknecht · Oct 8, 2021

Finding Available Domains with a Python Script

0
Sign in to vote or save

Eiko Wagenknecht · Eiko Wagenknecht

Eiko Wagenknecht

This post is also available in German

A small Python 3 script that helps determine which domains are still available.

Table of Contents

Why This Project?

I recently had the idea to set up a catch-all email address for online service registrations, using a unique email address for each service. This way, if there’s a data leak, I can see where it came from and, more importantly, selectively block compromised addresses.

Ideally, I’d like to have addresses like amazon@example.com and facebook@example.com. For this purpose, having a short domain name would be great. Of course, example.com is already taken, but perhaps there’s something else available with just a few letters?

But how do you find this out? There are countless websites where you can check if a specific name is already taken, but to systematically find available domains, this approach is far too cumbersome. Fortunately, there’s a service designed for exactly this purpose: WHOIS.

The following script is what I came up with. It’s certainly not a model example of clean programming, but it does exactly what I want: Find all available .de domains with a maximum of 5 characters before the dot.

It uses Python’s “whois” package, which throws an exception when an entry doesn’t exist - exactly what we need. Since this involves quite a lot of queries, the WHOIS server eventually starts returning empty responses. That’s why I built in a small waiting function that keeps retrying in these cases. First after 2 seconds, then 4 seconds, 8 seconds, etc., as we don’t want to unnecessarily spam the server.

The results are displayed live in the console for each domain checked, and a list of all found available domains is saved in a text file.

If you’re also searching for a domain: Have fun with it 🙂

You can download the script from GitHub: https://github.com/eikowagenknecht/whois

To run it, you need to have Python 3 installed and the whois package installed via pip install python-whois. Then you can save the script and run it with python ./runthis.py.

Results (As of October 2021)

Only domains consisting exclusively of letters a-z are considered.

Available 1-character .de domains: 0 out of 26 (0%)

Available 2-character .de domains: 0 out of 676 (0%)

Available 3-character .de domains: 0 out of 17576 (0%)

Available 4-character .de domains: 49694 out of 456976 (10.87%)

Sources

https://stackoverflow.com/questions/31597125/how-to-find-out-programmatically-if-a-domain-name-is-registered-or-not

https://stackoverflow.com/questions/5419389/how-to-overwrite-the-previous-print-to-stdout-in-python

Read the original on eikowagenknecht.com

Comments

Nothing yet. Say the first thing.

    Sign in to join the conversation.