diff --git a/bin/reverse-subnet.sh b/bin/reverse-subnet.sh new file mode 100755 index 0000000..aee1ac3 --- /dev/null +++ b/bin/reverse-subnet.sh @@ -0,0 +1,17 @@ +#!/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 + +