There are a lot of Whois Freeware Utitilies but none has many professional features like mass whois queries (for example what about making a list of all your domain’s expiration dates so as not to forget to renew them ?). Since Rebol is a messaging language with built-in internet protocols: http, ftp, pop, smtp, … and even whois, it is very easy to build your own tool in only a few minutes.

There is already the nettools application which does much more than just whois but our tutorial will build a more sophisticated Whois version which will take into account domain registration delegation.

The whois protocol syntax is very similar to the http protocol syntax:

Instead of


read http://google.com

you just need to write


read whois://email hidden; JavaScript is required

This will output in Rebol’s Console:


>> read whois://email hidden; JavaScript is required
== {
Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing regist...
>>

You can either write the result in a file and/or to the clipboard:


write clipboard:// read whois://email hidden; JavaScript is required
make-dir %/c/whois
write %/c/whois/google.com.txt read whois://email hidden; JavaScript is required

If you paste in notepad, this is the main result of Whois for Google.Com:



Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

GOOGLE.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM
GOOGLE.COM.ZZZZZ.DOWNLOAD.MOVIE.ONLINE.ZML2.COM
GOOGLE.COM.ZOMBIED.AND.HACKED.BY.WWW.WEB-HACK.COM
GOOGLE.COM.ZNAET.PRODOMEN.COM
GOOGLE.COM.WORDT.DOOR.VEEL.WHTERS.GEBRUIKT.SERVERTJE.NET
GOOGLE.COM.VN
GOOGLE.COM.UY
GOOGLE.COM.UA
GOOGLE.COM.TW
GOOGLE.COM.TR
GOOGLE.COM.SUCKS.FIND.CRACKZ.WITH.SEARCH.GULLI.COM
GOOGLE.COM.SPROSIUYANDEKSA.RU
GOOGLE.COM.SERVES.PR0N.FOR.ALLIYAH.NET
GOOGLE.COM.SA
GOOGLE.COM.PLZ.GIVE.A.PR8.TO.AUDIOTRACKER.NET
GOOGLE.COM.MX
GOOGLE.COM.IS.SHIT.SQUAREBOARDS.COM
GOOGLE.COM.IS.NOT.HOSTED.BY.ACTIVEDOMAINDNS.NET
GOOGLE.COM.IS.HOSTED.ON.PROFITHOSTING.NET
GOOGLE.COM.IS.APPROVED.BY.NUMEA.COM
GOOGLE.COM.HAS.LESS.FREE.PORN.IN.ITS.SEARCH.ENGINE.THAN.SECZY.COM
GOOGLE.COM.DO
GOOGLE.COM.CO
GOOGLE.COM.BR
GOOGLE.COM.BEYONDWHOIS.COM
GOOGLE.COM.AU
GOOGLE.COM.ACQUIRED.BY.CALITEC.NET
GOOGLE.COM

To single out one record, look it up with "xxx", where xxx is one of the
of the records displayed above. If the records are the same, look them up
with "=xxx" to receive a full display for each record.

>>> Last update of whois database: Sat, 18 Jul 2009 04:54:59 UTC <<<

Strange data stored for Google on Whois :) Let’s rather try Dzone.com:


write clipboard:// read whois://email hidden; JavaScript is required

This will output:


Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Domain Name: DZONE.COM
   Registrar: WILD WEST DOMAINS, INC.
   Whois Server: whois.wildwestdomains.com
   Referral URL: http://www.wildwestdomains.com
   Name Server: NS1.DZONE.COM
   Name Server: NS2.DZONE.COM
   Status: clientDeleteProhibited
   Status: clientRenewProhibited
   Status: clientTransferProhibited
   Status: clientUpdateProhibited
   Updated Date: 06-mar-2007
   Creation Date: 17-may-1998
   Expiration Date: 16-may-2011

>>> Last update of whois database: Sat, 18 Jul 2009 05:00:52 UTC <<<

You get 2 interesting informations: the age of the domain (with the creation date) and the potential expiration date.

You can also read that Dzone’s actual Whois Server is rather whois.wildwestdomains.com so you can make a second Whois Query to look at owner’s information if you need to contact him:


write clipboard:// read whois://email hidden; JavaScript is required

Output will be:


Registrant:
   Rick Ross
   1251 NW Maynard - Suite 300 Cary, NC 27513 Domain DZONE.COM
   ,
   United States

   Registered through: DZone Domains
   Domain Name: DZONE.COM
      Created on: 16-May-98
      Expires on: 15-May-11
      Last Updated on: 

   Administrative Contact:
      Ross, Rick  email hidden; JavaScript is required
      1251 NW Maynard - Suite 300 Cary, NC 27513
      ,
      United States
      +1.9196780300

   Technical Contact:
      Ross, Rick  email hidden; JavaScript is required
      1251 NW Maynard - Suite 300 Cary, NC 27513
      ,
      United States
      +1.9196780300

   Domain servers in listed order:
      NS1.DZONE.COM
      NS2.DZONE.COM

Now, if you don’t want to do things by hand, you can automatically extract the whois server with Rebol Parse function:


>> parse read whois://email hidden; JavaScript is required [thru "Whois Server: " copy Whois-Server to newline to end]
== true
>> Whois-Server
== "whois.wildwestdomains.com"
>>

This is the final program for any domain name (save, download or remotely execute the script at http://reboltutorial.com/source/whois.r see “The Amazing Power of Rebol: Execute Code Remotely“):


Rebol[]

domain: ask "domain name: "

;if you want to test the script in Rebol Console
;copy and paste the code in two steps:
;first the above instruction
;next the rest of instructions below

output: copy ""
append output (first-query-result: read rejoin [whois:// domain "@whois.internic.net"])
second-whois-extract-rule: [thru "Whois Server: " copy Second-Whois-Server to newline to end]
if (true = (parse first-query-result second-whois-extract-rule)) [
    parse output [copy output to "NOTICE" to end]; clean first-query-result of notice text
    parse (read rejoin [whois:// domain "@" Second-Whois-Server]) [to "Registrant:" copy second-output to end]
    append output (second-output)
]
write clipboard:// output

automate-whois-query1

This is the cleaned concatenated result of the two whois queries:


Whois Server Version 2.0

Domain names in the .com and .net domains can now be registered
with many different competing registrars. Go to http://www.internic.net
for detailed information.

   Domain Name: DZONE.COM
   Registrar: WILD WEST DOMAINS, INC.
   Whois Server: whois.wildwestdomains.com
   Referral URL: http://www.wildwestdomains.com
   Name Server: NS1.DZONE.COM
   Name Server: NS2.DZONE.COM
   Status: clientDeleteProhibited
   Status: clientRenewProhibited
   Status: clientTransferProhibited
   Status: clientUpdateProhibited
   Updated Date: 06-mar-2007
   Creation Date: 17-may-1998
   Expiration Date: 16-may-2011

>>> Last update of whois database: Sat, 18 Jul 2009 07:30:15 UTC <<<

Registrant:
   Rick Ross
   1251 NW Maynard - Suite 300 Cary, NC 27513 Domain DZONE.COM
   ,
   United States

   Registered through: DZone Domains
   Domain Name: DZONE.COM
      Created on: 16-May-98
      Expires on: 15-May-11
      Last Updated on: 

   Administrative Contact:
      Ross, Rick  email hidden; JavaScript is required
      1251 NW Maynard - Suite 300 Cary, NC 27513
      ,
      United States
      +1.9196780300

   Technical Contact:
      Ross, Rick  email hidden; JavaScript is required
      1251 NW Maynard - Suite 300 Cary, NC 27513
      ,
      United States
      +1.9196780300

   Domain servers in listed order:
      NS1.DZONE.COM
      NS2.DZONE.COM

You can now easily improve it for supporting multiple Whois Queries using Rebol’s foreach domain ["domain1.com" "domain2.com"], I’ll let the rest of this simple exercice to you.

The End.
whoisthumbnail

Bookmark and Share

Recent Articles