30 lines
608 B
Ruby
30 lines
608 B
Ruby
require './cve_report'
|
|
require 'zlib'
|
|
require 'json'
|
|
|
|
module KennaKdi
|
|
class GenerateCveIdsJson
|
|
attr_accessor :cve_data_path, :cve_files
|
|
|
|
def initialize(cve_data_path)
|
|
@cve_data_path = cve_data_path
|
|
@cve_files = Dir.glob(File.join(cve_data_path, '**', '*')).select{|file| File.file?(file)}
|
|
end
|
|
|
|
def all_reports
|
|
cve_files.map do |cve_file|
|
|
CveReport.new(cve_file)
|
|
end
|
|
end
|
|
|
|
def perform
|
|
cve_reports = all_reports
|
|
|
|
cve_ids = cve_reports.map do |cve_report|
|
|
cve_report.cve_ids
|
|
end.flatten
|
|
|
|
cve_ids.to_json
|
|
end
|
|
end
|
|
end
|