home *** CD-ROM | disk | FTP | other *** search
- #!/usr/local/bin/kermit +
- #
- # One-step WHOIS for any domain name.
- # Usage: kwhois domain.
- # Gets the name of the whois for the domain from the main whois server,
- # then sends the request to the registrar for that domain.
- #
- # F. da Cruz, Columbia University, 28 October 2006
-
- open !read "whois \%1" # Run whois on the domain
- if fail exit 1 # Check for failure
- .target = "Whois Server:" # String to look for in response
- .len := \flen(\m(target)) # Length of string
- while 1 { # Loop through response
- read line # Read a line
- if fail break # Check for end
- .x := \findex(\m(target),\m(line)) # Look for target string
- if not x continue # Not here - get next line
- close read # Got it - stop reading
- incr x \m(len)+1 # Point past end of target string
- !whois -h \s(line[x]) \%1 # Run the appropriate whois command
- exit \v(pexitstat) # Return its exit status
- }
- exit 1 "Not found: \%1" # Domain was not found - fail
-