#! /bin/sh # ipscan - scan IP network for non-DNS listed hosts using PING # usage: ipscan domain class-C-subnet # example: ipscan wr.usgs.gov 130.118.25 # Rex Sanders, USGS, 8/24/94 # Get current list of DNS-registered hosts echo "ls $1" | /usr/etc/nslookup | \ grep " $2"'\.[0-9][0-9]*$' | \ sed -e 's/^ .* '"$2"'\./'"$2"'./' | \ sort -u > /tmp/ipscan1.$$ # Generate list of all possible Class C addresses awk 'END {i=1; while (i<=254) {printf "'"$2"'.%d\n", i; i++}}' < /dev/null | \ sort > /tmp/ipscan2.$$ # Generate list of non-DNS-registered addresses comm -13 /tmp/ipscan1.$$ /tmp/ipscan2.$$ | sort -t. +2 -3n +3n > /tmp/ipscan3.$$ rm -f /tmp/ipscan1.$$ /tmp/ipscan2.$$ # Ping each non-DNS-registered address for i in `cat /tmp/ipscan3.$$` do /usr/etc/ping -s $i 56 1 | fgrep "bytes from $i" done rm /tmp/ipscan3.$$