added a method to pull down just mozilla cpes from a cve

This commit is contained in:
Brendan McDevitt 2022-09-29 00:15:22 -05:00
parent 278991912e
commit 47b51b2d87

View file

@ -135,6 +135,15 @@ class MozillaSecurityAdvisoryScraper
cpes = json.dig('matchStrings').map {|match_strings| match_strings.dig('matches')}
end
def get_mozilla_cpes_from_cve(cve_id)
cve_cpes = cve_cpes_from_nvd(cve_id)
cve_cpes.flat_map do |cpe_configuration|
cpe_configuration.select do |cpe_hash|
cpe_hash.dig('cpeName').start_with?('cpe:2.3:a:mozilla')
end
end.map {|cpe_h| cpe_h.dig('cpeName')}
end
def product_name_to_cpe
# todo: record cpe translation
{