chg: [stackpath] host IPv6 addresses are without subnet
parent
95cc22e364
commit
9f426c8099
|
@ -2,7 +2,7 @@
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from generator import download_to_file, get_version, write_to_file, get_abspath_source_file
|
from generator import download_to_file, get_version, write_to_file, get_abspath_source_file
|
||||||
|
import ipaddress
|
||||||
|
|
||||||
def process(files, dst):
|
def process(files, dst):
|
||||||
warninglist = {
|
warninglist = {
|
||||||
|
@ -18,11 +18,15 @@ def process(files, dst):
|
||||||
with open(get_abspath_source_file(file), 'r') as f:
|
with open(get_abspath_source_file(file), 'r') as f:
|
||||||
ips = f.readlines()
|
ips = f.readlines()
|
||||||
for ip in ips:
|
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)
|
write_to_file(warninglist, dst)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
sp_base_url = "https://support.stackpath.com/hc/en-us/article_attachments/360083735711/"
|
sp_base_url = "https://support.stackpath.com/hc/en-us/article_attachments/360083735711/"
|
||||||
uri_list = ['ipblocks.txt']
|
uri_list = ['ipblocks.txt']
|
||||||
|
|
Loading…
Reference in New Issue