List of Domains to do whois

Discussion of programming on Linux, including shell scripting, perl, python, c/c++, mono, java. Whatever tickles your fancy.
Post Reply
shakeel_jee7
Naik
Posts: 64
Joined: Sat Dec 04, 2004 6:30 pm
Location: Islamabad, Pakistan.

List of Domains to do whois

Post by shakeel_jee7 »

AoA
Hi Everybody!

I have a problem in creating a script for checking a list of domains against whois records.
e.g, list of domains
www.abc.com
www.def.com.pk
www.ghi.edu
.....
.....


I have to create a bash script, which will check each domain against its whois record and display some information from it, e.g, Domain Expiry date, related nameservers, etc...

when I manually check a domain name against whois in Bash, e.g,
whois www.yahoo.com
It gives error no match for domain www.yahoo.com.

I am using RHEL 4. I am creating this script on my DNS server. where I purify these domians from my named.conf. i have done all this task of purifying domains names, but now I have to do whois against each domain name.
Kindly help in this regard.

Thanks and Regards,

Shakeel
* * *
Shakeel Ahmed
Registered Linux User # 423792

"The Shortest Distance b/w a Problem & its solution, is distance between ur Knees & the Floor. The one who kneels to Allah can stand upto anything!!"
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

that's probably because www.yahoo.com isn't a domain. yahoo.com is the domain.

what do you mean by "purify"?
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shakeel_jee7
Naik
Posts: 64
Joined: Sat Dec 04, 2004 6:30 pm
Location: Islamabad, Pakistan.

Post by shakeel_jee7 »

Thanks Lambda, for your kind reply.
But this service only checks for .COM, .NET, and .EDU domains. Other domains cannot be checked here.
What is the possible solution, for checking all the domains in the list that can be of any type means, .com, .com.pk, .org, etc. in the bash through a script.
"Purify" means that I extracted the domains from the named.conf file where there is many other information.

Regards,
* * *
Shakeel Ahmed
Registered Linux User # 423792

"The Shortest Distance b/w a Problem & its solution, is distance between ur Knees & the Floor. The one who kneels to Allah can stand upto anything!!"
lambda
Major General
Posts: 3452
Joined: Tue May 27, 2003 7:04 pm
Location: Lahore
Contact:

Post by lambda »

.pk doesn't have a whois service. supposedly they'll add one, but until then, you'll have to do something like

Code: Select all

curl http://pk5.pknic.net.pk/pk5/lookup.PK?name=something.pk'
or

Code: Select all

lynx -dump 'http://pk5.pknic.net.pk/pk5/lookup.PK?name=something.pk'
you probably should write a script in python or something to parse the output and fetch the fields you want.

please don't use the term 'purify' in that context. if your goal is to check if the domains listed in your named.conf file use your nameserver or not, you can easily ask the parent nameservers. for example, type

Code: Select all

host -t ns pk.
to get pk's nameservers, and then ask one of them:

Code: Select all

host -t ns google.com.pk. m-2.pknic.net.pk.
do the same for

Code: Select all

host -t ns com.
and

Code: Select all

host -t ns example.com. a.gtld-servers.net.
the parent nameservers change very rarely -- maybe once every few years.
Watch out for the Manners Taliban!
Isn't it amazing how so many people can type "linuxpakistan.net" into their browsers but not "google.com"?
shakeel_jee7
Naik
Posts: 64
Joined: Sat Dec 04, 2004 6:30 pm
Location: Islamabad, Pakistan.

Post by shakeel_jee7 »

AoA

Thanks Dear Lambda, for your kind reply. I will try this Solution, very soon.

Regards,

Shakeel
* * *
Shakeel Ahmed
Registered Linux User # 423792

"The Shortest Distance b/w a Problem & its solution, is distance between ur Knees & the Floor. The one who kneels to Allah can stand upto anything!!"
Post Reply