diff --git a/src/palo-alto-networks.py b/src/palo-alto-networks.py new file mode 100644 index 00000000..197ee97e --- /dev/null +++ b/src/palo-alto-networks.py @@ -0,0 +1,34 @@ +import json +import urllib.request +import datetime +from bs4 import BeautifulSoup + +URL = "https://www.paloaltonetworks.com/services/support/end-of-life-announcements/end-of-life-summary" + +ID_MAPPING = { + "pan-os-panorama": "pan-os", + "globalprotect": "pan-gp" +} + +def update_releases(html_id, file): + list = {} + with urllib.request.urlopen(URL, data=None, timeout=5) as response: + soup = BeautifulSoup(response, features="html5lib") + table = soup.find(id=html_id) + for tr in table.findAll('tr')[3:]: + td_list = tr.findAll('td') + version = td_list[0].get_text() + try: + month,date,year = td_list[1].get_text().split('/') + abs_date = f"{year}-{month:0>2}-{date:0>2}" + except Exception as e: + date = datetime.datetime.strptime(td_list[1].get_text(), "%B %d, %Y") + abs_date = date.strftime("%Y-%m-%d") + + list[version] = abs_date + + with open('releases/%s.json' % file, 'w') as f: + f.write(json.dumps(list, indent=2)) + +for html_id in ID_MAPPING: + update_releases(html_id, ID_MAPPING[html_id]) diff --git a/src/pan-gp.py b/src/pan-gp.py deleted file mode 100644 index 9263c945..00000000 --- a/src/pan-gp.py +++ /dev/null @@ -1,19 +0,0 @@ -import json -import urllib.request -from bs4 import BeautifulSoup - -URL = "https://www.paloaltonetworks.com/services/support/end-of-life-announcements/end-of-life-summary" - -list = {} -with urllib.request.urlopen(URL, data=None, timeout=5) as response: - soup = BeautifulSoup(response, features="html5lib") - table = soup.find(id='globalprotect') - for tr in table.findAll('tr')[3:]: - td_list = tr.findAll('td') - version = td_list[0].get_text() - month,date,year = td_list[1].get_text().split('/') - abs_date = f"{year}-{month:0>2}-{date:0>2}" - list[version] = abs_date - -with open('releases/pan-gp.json', 'w') as f: - f.write(json.dumps(list, indent=2))