chg: [stackpath] host IPv6 addresses are without subnet

pull/181/head
Alexandre Dulaunoy 2021-04-21 16:42:55 +02:00
parent 95cc22e364
commit 9f426c8099
No known key found for this signature in database
GPG Key ID: 09E2CD4944E6CBCD
1 changed files with 7 additions and 3 deletions

View File

@ -2,7 +2,7 @@
# -*- coding: utf-8 -*-
from generator import download_to_file, get_version, write_to_file, get_abspath_source_file
import ipaddress
def process(files, dst):
warninglist = {
@ -18,11 +18,15 @@ def process(files, dst):
with open(get_abspath_source_file(file), 'r') as f:
ips = f.readlines()
for ip in ips:
warninglist['list'].append(ip.strip())
iptoadd = ip.strip()
try:
ipaddress.ip_network(ip.strip())
except ValueError as err:# if it's host given strip to the subnet
iptoadd = str(ipaddress.IPv6Interface(ip.strip()).ip)
warninglist['list'].append(iptoadd)
write_to_file(warninglist, dst)
if __name__ == '__main__':
sp_base_url = "https://support.stackpath.com/hc/en-us/article_attachments/360083735711/"
uri_list = ['ipblocks.txt']