picatz / isit

💫 The domain availability command-line uitlity.
15 stars 1 forks source link

Add multiple whois HTTP backends #2

Open picatz opened 6 years ago

picatz commented 6 years ago

In truth, to search for if a domain is available via HTTP backends can be pretty darn straight forward.

Like anything else in like, or in programming, it is not perfect.

How To

You go to google.com and type in a domain finding application to register a site.

On most sites, you have a nice search bar and we can type in the domain we like, you know the drill I'm sure.

You type in facebook.com to check if it's available for your next startup for faces in books.

You see that it's already been registered. You will see other information along with it:

Domain Name: facebook.com
Registry Domain ID: 2320948_DOMAIN_COM-VRSN
Registrar WHOIS Server: whois.markmonitor.com
Registrar URL: http://www.markmonitor.com
Updated Date: 2016-11-29T12:28:07-0800
Creation Date: 1997-03-28T21:00:00-0800
Registrar Registration Expiration Date: 2025-03-29T00:00:00-0700
Registrar: MarkMonitor, Inc.

There's probably a mess of other stuff on the screen. But, we could simply do a grep for Registrar in our command-line with curl and easily check if a domain in grep with some BASH

curl https://www.whois.com/whois/facebook.com -s | grep "Registrar" -q

-s will suppress output from cur and -q will suppress output from grep

This allows us to use that logic like so:

if $(curl https://www.whois.com/whois/facebook.com -s | grep "Registrar" -q); then 
    echo "facebook.com is available!"
else
    echo "facebook.com isn't available"
fi

Go Code not BASH Scripts

Then, all we need to do is translate that logic into Go code.

That's it.

Multiple Backends

We can't just pseudo curl one site. We need maximum efficiency for large batches and need to cross-reference results. This is where multiple HTTP backends comes in most handy.

picatz commented 6 years ago

Domainr

Some more BASH to check Domainr which was some weirder logic:

curl https://domainr.com/facebook.com -s | grep "registrar=" -q
picatz commented 6 years ago

Ultratools

More BASH to check Ultratools which has some weirder logic too:

curl https://www.ultratools.com/tools/ipWhoisLookupResult -s -X POST -d 'ipAddress=facebook.com' | grep "Registration" -q
picatz commented 6 years ago

Whois-Search

Even more BASH? If you insist.

curl -s https://www.whois-search.com/whois/facebook.com | grep -w "Registrar" -q

The -w option for grep ensures a more exact match. 🏓

picatz commented 6 years ago

Verisign

Need more weird BASH? Perfect.

curl -s "https://registrar.verisign-grs.com/webwhois-ui/rest/whois?q=facebook.com&tld=com&type=domain" | grep -w "Registrar" -q

But, it's heavily rate limited...

{"eppStatusDescEnabledTld":"false","message":"Error","responseType":"captchaNeeded"}
picatz commented 6 years ago

Nominet

Can check domain suffixes for .uk, .co.uk, .org.uk, and .me.uk and I think even .cymru and .wales --- ok then.

curl -s "https://www.nominet.uk/whois/?query=facebook.uk#whois-results" | grep -w "Registrar:" -q
picatz commented 6 years ago

EasyWhois

Yo 'dawg, I heard you like that curl?

curl "https://www.easywhois.com/" -X POST -d "mode=whois" -d "domain=facebook.com" | grep -w "Registrar"