msgbartop
A chronological documentation test project, nothing serious, really!
msgbarbottom

04 Sep 2007 nslookup-scan of IP-range/subnet

#!/bin/bash
# nslookup-scan of IP-range

# It's possible to add more networks separated with space
NETS="192.168.0"

IPRange="1 254"
for NET in $NETS; do
  for n in $(seq $IPRange); do
        ADDR=${NET}.${n}
        echo "${ADDR},`nslookup ${ADDR} | awk -F "=" '{ print $2 }'|sed 's/^[ t]*//' | sed '/^$/d' | |sed 's/.$//'`"
  done
done

Result

192.168.0.1,cba.infra.no
192.168.0.2,bca.infra.no
192.168.0.3,abc.infra.no
192.168.0.4,
192.168.0.5,
192.168.0.6,
192.168.0.7,
192.168.0.8,

Tags: , , ,

Posted by