Subject: Re: whois?

From: "Robert G. Ferrell" <[email-masked]>
Date: Mon, 13 Dec 1999 13:21:46 -0600 (CST)

>I'm just wondering -- my whois command doesn't turn up contact information
>for domains anymore. What's going on? I get a registrar's name instead ....

In case anyone's interested, I wrote a little Perl script to sort of streamline 
command line whois, because I use it a lot and I got tired of typing "-h 
whois.whatever.net."  It also comes in handy now that the builtin Unix whois is 
broken.

I changed /bin/whois to /bin/whois_old to keep things as similar as possible.
Obviously, you can substitute any servers you like for each of these, or add 
your own.

#!/usr/local/bin/perl
# Script to interface with whois_old
# Fixes whois broken by NSI on 12/1/99
# Also adds some shortcut functionality
# Revised 12/2/99, RGF

$who = qq(/bin/whois_old);
chomp($host = $ARGV[0]);
chomp($target = $ARGV[1]);
$args = 0;
$args = 1 if (defined($ARGV[1]));

if ($args == 0) {
	$h = qq(whois.networksolutions.com);
	$t = $host;
	&go;
} elsif ($args == 1) {
	if ($host eq "u") {
		$h = qq(whois.networksolutions.com);
		$t = $target;
		&go;
	} elsif ($host eq "a") {
		$h = qq(whois.apnic.net);
		$t = $target;
		&go;
	} elsif ($host eq "e") {
		$h = qq(whois.ripe.net);
		$t = $target;
		&go;
	} elsif ($host eq "n") {
		$h = qq(whois.arin.net);
		$t = $target;
		&go;
	} else {
		print <<"EOP";
		
Usage: whois [host] target

Valid host arguments are

a	APNIC
e	RIPE
n	ARIN
u	NSI

default (no host) is NSI (whois.networksolutions.com)

EOP
		exit();
	}
}

sub go {
	$result = qx($who -h $h $t);
	print "$result\n";
	exit();
}
# End of script

Robert G. Ferrell
Internet Technologist
National Business Center, US DoI
[email-masked]