New gTLDs and whois command

Check out this way more elegant workaround : whois.conf by Demiam

Hello there, since it’s quite a few weeks since I last posted something here, I felt like moving things up a bit.

With more than 400 new gTLDs validated by ICANN http://newgtlds.icann.org/en/ , like .sexy or even .游戏 (Chinese for games), sooner or later, you may have to lookup for whois informations related to domains using these new extensions.

I reserved recently some new gTLDs and foolishly tried to whois my new domains, let’s see what happened :

$ whois hexa.zone
No whois server is known for this kind of object.

Which is absolutely normal since I didn’t mention any whois database host.  To see some result, I should have written

$ whois hexa.zone -h whois.donuts.co

We could manually edit a whois.conf file and fill in servers (such as whois.donuts.co) returned by a lookup search on whois.iana.org

$ whois .zone -h whois.iana.org | grep “whois:”

But it’s not my cup of tea, adding a line for each TLD, re-editing it whenever new ones will be validated, very unpleasant in my eyes.

So I came up to this little script :

#!/bin/sh
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
# THE SOFTWARE.
if [ -z $1 ]; then
	# Check if we passed an argument
	echo "Usage : $0 [domain_name.tld]"
	exit
else
	domain=$1
fi

# Extract the tld from the domain name
tld=`echo $domain | awk -F'.' '{print $NF}'`

# Search which database host is associated to this tld in the IANA whois db
search=`whois .$tld -h whois.iana.org | egrep -e "^whois:" | awk '{print $NF}'` 

if [ -n "$search" ]; then
	# Finally execute the whois
	echo "Using $search database for $domain"
	whois $domain -h $search
fi

 

That’s all, you may copy the script in your /usr/bin/ folder then simply call

$ ewhois hexa.zone

or any other new TLD should give you a result.

 

Thanks for reading, and have a nice day !

 

Thanks Berkay for the modifications

Hey, I have a question. When using this script, the whois client only searches at the specified whois server but this sometimes is not that useful. Example: when you try to whois google.com with this, it finds out that whois.verisign-grs.com is the whois server to use but that server only has simple information about domain and registrars whois server. To get the actual information, it should query the whois.markmonitor.com. Normally, when you’re just using whois, it automatically searches the registrars whois server too but this script does not as it has a specified whois server. How could that be achieved with this?

available at https://gist.github.com/introducial/26d293936f647bbe3ccb

gtlds

5 thoughts on “New gTLDs and whois command”

      1. Hey, I have a question. When using this script, the whois client only searches at the specified whois server but this sometimes is not that useful. Example: when you try to whois google.com with this, it finds out that whois.verisign-grs.com is the whois server to use but that server only has simple information about domain and registrars whois server. To get the actual information, it should query the whois.markmonitor.com. Normally, when you’re just using whois, it automatically searches the registrars whois server too but this script does not as it has a specified whois server. How could that be achieved with this?

        Also, what is this script’s licence? GPLv3, MIT or something else?

        Thanks.

          1. Sorry for the late reply, and thank you for mentioning me in the git. You’re totally right, nice catch on regular TLDs.

            Let’s say this is under MIT licence, flexible one 😉

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>