|
21 | 21 | from vulnerabilities.severity_systems import CVSSV3 |
22 | 22 | from vulnerabilities.utils import fetch_response |
23 | 23 |
|
24 | | -PHOTON_URLS = [ |
25 | | - "https://packages.vmware.com/photon/photon_cve_metadata/cve_data_photon1.0.json", |
26 | | - "https://packages.vmware.com/photon/photon_cve_metadata/cve_data_photon2.0.json", |
27 | | - "https://packages.vmware.com/photon/photon_cve_metadata/cve_data_photon3.0.json", |
28 | | - "https://packages.vmware.com/photon/photon_cve_metadata/cve_data_photon4.0.json", |
29 | | - "https://packages.vmware.com/photon/photon_cve_metadata/cve_data_photon5.0.json", |
30 | | -] |
31 | | - |
32 | 24 |
|
33 | 25 | class VmwarePhotonImporterPipeline(VulnerableCodeBaseImporterPipelineV2): |
34 | 26 | """Collect advisories from Vmware Photon Advisory. |
@@ -60,12 +52,18 @@ def steps(cls): |
60 | 52 |
|
61 | 53 | def fetch(self): |
62 | 54 | self.records = [] |
63 | | - for url in PHOTON_URLS: |
| 55 | + base_url = self.repo_url |
| 56 | + |
| 57 | + response = fetch_response(base_url) |
| 58 | + photon_files = re.findall(r'href="(cve_data_photon[0-9.]+\.json)"', response.text) |
| 59 | + |
| 60 | + for file_name in photon_files: |
| 61 | + url = base_url + file_name |
64 | 62 | self.log(f"Fetching `{url}`") |
65 | 63 | response = fetch_response(url) |
66 | 64 | if response: |
67 | 65 | self.records.extend(response.json()) |
68 | | - self.log(f"Fetched {len(self.records):,d} total records from {len(PHOTON_URLS)} sources") |
| 66 | + self.log(f"Fetched {len(self.records):,d} total records from {len(photon_files)} sources") |
69 | 67 |
|
70 | 68 | def group_records_by_cve(self): |
71 | 69 | """ |
|
0 commit comments