добавляет больше IP-адресов

This commit is contained in:
Maxim Slipenko 2022-09-18 09:14:58 +03:00
parent aec687122a
commit 3d13b8263f
Signed by: Maks1mS
GPG Key ID: 5945C22851757472
3 changed files with 23 additions and 2 deletions

View File

@ -46,6 +46,14 @@ chess.com
# developers.google.com # developers.google.com
# #
developers.google.com developers.google.com
142.250.150.101/32 # developers.google.com
64.233.163.102/32 # developers.google.com
developers.home.google.com developers.home.google.com
173.194.222.113/32 # developers.home.google.com
googleapis.com googleapis.com
firebase.google.com 173.194.221.105/32 # googleapis.com
firebase.google.com
74.125.205.138/32 # firebase.google.com

View File

@ -1,8 +1,13 @@
192.229.221.58/32 # us.download.nvidia.com 192.229.221.58/32 # us.download.nvidia.com
172.65.251.78/32 # gitlab.com 172.65.251.78/32 # gitlab.com
74.125.131.101/32 # developers.google.com
142.250.150.101/32 # developers.google.com
64.233.163.102/32 # developers.google.com 64.233.163.102/32 # developers.google.com
142.250.150.102/32 # developers.home.google.com
173.194.222.113/32 # developers.home.google.com 173.194.222.113/32 # developers.home.google.com
64.233.165.103/32 # googleapis.com
173.194.221.105/32 # googleapis.com 173.194.221.105/32 # googleapis.com
74.125.131.102/32 # firebase.google.com
74.125.205.138/32 # firebase.google.com 74.125.205.138/32 # firebase.google.com
35.190.247.0/24 # google (spf) 35.190.247.0/24 # google (spf)
64.233.160.0/19 # google (spf) 64.233.160.0/19 # google (spf)

View File

@ -1,3 +1,4 @@
import ipaddress
import socket import socket
from collections import defaultdict from collections import defaultdict
from utils import prettyprint from utils import prettyprint
@ -12,7 +13,14 @@ def main(file_data: list):
if l.startswith('#') or l == '': if l.startswith('#') or l == '':
continue continue
dict[socket.gethostbyname(l) + '/32'].append(l) domain_or_range, comment, *_ = [x.strip() for x in l.split('#')] + [None]
try:
ipaddress.ip_network(domain_or_range)
dict[domain_or_range].append(comment)
except ValueError:
dict[socket.gethostbyname(domain_or_range) + '/32'].append(l)
ips = list(dict.keys()) ips = list(dict.keys())