DPR-blocked-sites/scripts/1_ips_from_domains_txt.py

17 lines
325 B
Python

import socket
ips = []
with open('ips.txt', 'w') as out:
for line in open('domains.txt'):
l = line.strip()
if l.startswith('#') or l == '':
continue
ips.append(socket.gethostbyname(l) + '/32')
ips = list(dict.fromkeys(ips))
for ip in ips:
out.write(ip + '\n')