#!/bin/csh # # Check a host or network address with various NIC's # # Usage: nicinfo host.or.net.address # # This script simply runs 'whois -h ' for the given address on # a list of Network Information Centers, to quickly find the owner # of the network. # # Eric Myers - 13 August 1998 # Department of Physics, University of Michigan, Ann Arbor 48109-1120 # @(#) $Revision: 1.2 $ $Date: 1999/03/31 16:53:40 $ ####################################################################### # Where to look: set NICLIST= ( rs.internic.net whois.arin.net whois.ripe.net whois.apnic.net ) set NICLIST= ( $NICLIST whois.nic.gov whois.nic.mil ) # Where to log: set LOG=nicinfo.log # Just the paths that are needed: set path=( /usr/ucb /usr/bin /bin /usr/etc /usr/local/bin ) # end configuration #################################### set TMPFILE=/tmp/nicinfo.$$ # Get the address if ( $#argv < 1 ) then echo "usage: nicinfo host.or.net.name" exit ( -1 ) endif set Addr=$1 shift cat /dev/null > $LOG # Look it up foreach NIC ( $NICLIST ) echo -n "Trying $NIC ..." echo "% whois -h $NIC $Addr" >>$LOG whois -h $NIC $Addr >$TMPFILE if ( -z $TMPFILE ) continue set X=`egrep "No match for|No entries found." $TMPFILE ` if ( "$X" != "" ) then echo "Failed." else echo "FOUND." cat $TMPFILE >> $LOG endif end /bin/rm $TMPFILE cat $LOG echo "Logged to $LOG." exit 0