dotfiles/bin/reverse-subnet.sh

18 lines
301 B
Bash
Executable File

#!/bin/bash
IP4BLOCK="$1"
echo "Doing reverse lookup for $IP4BLOCK.0/24..."
ctr=1
while [ $ctr -le 255 ]; do
ipaddress="$IP4BLOCK.$ctr";
result=`dig +short -x $ipaddress`;
result=`echo $result | sed -e 's#\n##g'`
if [ "$result" != "" ]; then
echo "$ipaddress $result";
fi;
((ctr++));
done