добавляет больше IP-адресов
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import ipaddress
|
||||
import socket
|
||||
from collections import defaultdict
|
||||
from utils import prettyprint
|
||||
@@ -12,7 +13,14 @@ def main(file_data: list):
|
||||
if l.startswith('#') or l == '':
|
||||
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())
|
||||
|
||||
|
||||
Reference in New Issue
Block a user