A bit crude but works
# Prerequisite: brew install ipcalc # Place all the IP Addresses in a text file IPList.txt echo "IP Address|Root Owner|Owner|IP CIDR|IP RDNS" | tee ARIN.txt for ip in $(cat IPList.txt | sort); do arin=$(whois -h whois.arin.net "$ip") rootOwner=$(echo "$arin" | grep 'Organization' | cut -d ':' -f2 | sed 's/^[ \t]*//;s/[ \t]*$//') # echo $rootOwner Owner=$(whois -h whois.arin.net "n $ip" | tr '\n' '|' | cut -d '|' -f2 | cut -d '(' -f1 | sed 's/^[ \t]*//;s/[ \t]*$//' | grep -v 'CIDR') ipCIDR=$(echo $(ipcalc $(echo $arin | grep 'NetRange' | cut -d ':' -f2 | sed 's/^[ \t]*//;s/[ \t]*$//') | grep -v deaggregate) | sed 's/^[ \t]*//;s/[ \t]*$//') # echo $ipCIDR ipRDNS=$(dig -x $ip | grep -v ';' | tr '\n' ' ' | awk -F" " '{print " "$5}' | sed 's/^[ \t]*//;s/[ \t]*$//') echo "$ip|$rootOwner|$Owner|$ipCIDR|$ipRDNS" done | tee -a ARIN.txt
Last Updated on August 17, 2024