let init = { "containers": { "cna": { "affected": [ { "product": "Product 1", "vendor": "Vendor 1", "defaultStatus": "Unknown", "versions": [ { "version": "2.0.0", "versionType": "semver", "lessThan": "2.*", "status": "affected", "changes": [ { "at": "2.5.2", "status": "unaffected" }, { "at": "2.6.0", "status": "affected" }, { "at": "2.6.3", "status": "unaffected" } ] } ] }, { "product": "Product 2", "vendor": "Vendor 1", "defaultStatus": "Affected", "versions": [ { "version": "0", "versionType": "git", "lessThan": "*", "repo": "https://github.com/example/test", "status": "unaffected", "changes": [ { "at": "123abc...", "status": "affected" }, { "at": "234bcd...", "status": "unaffected" }, { "at": "567ef0...", "status": "unaffected" } ] } ] } ], "descriptions": [ { "lang": "en", "value": "A Sample from CVE Project" } ], "problemTypes": [ { "descriptions": [ { "description": "Elevation of Privilege", "lang": "en", "type": "text" } ] } ], "providerMetadata": { "dateUpdated": "2100-06-17T00:00:00", "orgId": "f38d0000-7300-4000-92c1-6c4a2c647800", "shortName": "cveproject" }, "references": [ { "tags": [ "related", "x_refsource_MISC" ], "url": "https://mitre.org" } ], "state": "PUBLISHED", "cveId": "CVE-2100-1000", "dateUpdated": "2100-06-17T00:00:00", "shortName": "cveproject", "cvssList": [] } }, "cveMetadata": { "assignerOrgId": "f38d0000-7300-4000-92c1-6c4a2c647800", "assignerShortName": "cveproject", "cveId": "CVE-2100-1000", "dateUpdated": "2100-06-17T00:00:00", "state": "PUBLISHED" }, "dataType": "CVE_RECORD", "dataVersion": "5.0" } function loadCVE(value) { var realId = value.toUpperCase().match(/(CVE-(\d{4})-(\d{1,12})(\d{3}))/); if (realId) { $('#cve').val(value.toUpperCase()); var id = realId[1]; var year = realId[2]; var bucket = realId[3]; var jsonURL = 'https://github.com/CVEProject/cvelistV5/tree/master/review_set/' + year + '/' + bucket + 'xxx/' + id + '.json' fetch('https://raw.githubusercontent.com/CVEProject/cvelistV5/master/review_set/' + year + '/' + bucket + 'xxx/' + id + '.json', { method: 'GET', credentials: 'omit', headers: { 'Accept': 'application/json, text/plain, */*' }, redirect: 'error' }) .then(function (response) { if (!response.ok) { throw Error(id + ' ' + response.statusText); } return response.json(); }) .then(function (res) { if (res.containers) { update(res); } else { alert("CVE does not have correct information"); } }) .catch(function (error) { alert("Error in collecting CVE record for " + error.message); }) } else { alert("CVE number is invalid "+value); } return false; } function vparse(cve) { var rstring = '
'; rstring += ''; } else { console.log(p); rstring += 'No versions listed'; } rstring += '' } return rstring + 'Default Status: ' rstring += ' ' + ('defaultStatus' in p ? p.defaultStatus : 'Unknown') + '' if(p.versions) { var rows = { affected: [], unaffected: [], unknown: [] }; for(v of p.versions) { if(v.lessThan) { rows[v.status].push('' + v.version + 'before' + v.lessThan + ''); } else if(v.lessThanOrEqual) { rows[v.status].push('' + v.version + 'through' + v.lessThanOrEqual + ''); } else { rows[v.status].push('' + v.version + ''); } if (v.version) { if(v.changes) { for(c of v.changes) { rows[c.status].push('from' + c.at + ''); } } } } for(r in rows) { if(rows[r].length) { rstring += '' + r + ''; for(l in rows[r]) { rstring += '
"; } } rstring += '- ' + rows[r][l] + '
'; } rstring += "