2022-04-26 23:56:35 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class CisaKnownExploit < ActiveRecord::Base
|
|
|
|
def self.find_by_id(id)
|
|
|
|
find_by(cve_id: id)
|
|
|
|
end
|
|
|
|
|
2022-04-27 01:11:36 -05:00
|
|
|
def self.cve_id(cve_id)
|
|
|
|
last.vulnerabilities.select { |vuln| vuln if vuln.dig('cve_id') == cve_id }
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.cves_from_year(year)
|
|
|
|
last.vulnerabilities.select { |vuln| vuln if vuln.dig('cve_id') =~ /CVE-#{year}-\d{4,7}/ }
|
2022-04-26 23:56:35 -05:00
|
|
|
end
|
|
|
|
end
|