home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / ckscripts / kwhois < prev    next >
Text File  |  2020-01-01  |  1KB  |  25 lines

  1. #!/usr/local/bin/kermit +
  2. #
  3. # One-step WHOIS for any domain name.
  4. # Usage: kwhois domain.
  5. # Gets the name of the whois for the domain from the main whois server,
  6. # then sends the request to the registrar for that domain.
  7. #
  8. # F. da Cruz, Columbia University, 28 October 2006
  9.  
  10. open !read "whois \%1"                    # Run whois on the domain
  11. if fail exit 1                            # Check for failure
  12. .target = "Whois Server:"                 # String to look for in response
  13. .len := \flen(\m(target))                 # Length of string
  14. while 1 {                                 # Loop through response
  15.     read line                             # Read a line
  16.     if fail break                         # Check for end
  17.     .x := \findex(\m(target),\m(line))    # Look for target string
  18.     if not x continue                     # Not here - get next line
  19.     close read                            # Got it - stop reading
  20.     incr x \m(len)+1                      # Point past end of target string
  21.     !whois -h \s(line[x]) \%1             # Run the appropriate whois command
  22.     exit \v(pexitstat)                    # Return its exit status
  23. }
  24. exit 1 "Not found: \%1"                   # Domain was not found - fail
  25.