Can I pass file in "ip_list" and "banned_subnets". I have multiple list of IP's which need to be get match with multiple subnets, and it is not possible to list them all in script. For that I have created two files ipaddr_list
which has list of IP's and sub_list
which has list of subnets.
Can some suggest how do I get this in below script:
import netaddr
ip_list = ['10.22.140.10', '10.11.14.11', '10.71.13.13', '10.10.131.2', '10.12.6.11', '10.1.6.10']
banned_subnets = ['10.1.6.0/24', '10.10.13.0/24', '10.10.14.0/24' ]
new_list = [str(ip) for ip in netaddr.IPSet(ip_list) & (netaddr.IPSet(banned_subnets))]
print new_list