ip_type.py

Check if IP addresses are public or private.

#!/usr/bin/python
import sys
import ipaddress

if len(sys.argv) != 2:
  print("Usage: " + str(sys.argv[0]) + " IP")
else:
  ip = str(sys.argv[1])

  if ipaddress.ip_address(ip).is_private:
    print(ip + " Private")
  else:
    print(ip + " Public")

Put IP addresses in a file and call in a loop.

for ip in $(cat IPs.txt); do ./ip_type.py $ip; done