Module: FIDIUS::MSParser

Defined in:
lib/cveparser/ms_parser.rb

Constant Summary collapse

BASE_URL =
"http://cve.mitre.org/data/refs/refmap/source-MS.html"

Class Method Summary collapse

Class Method Details

.parse_ms_cveObject

Calls ‘parse’ and stores the mapping in the database



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/cveparser/ms_parser.rb', line 18

def self.parse_ms_cve
  entries = parse
  counter = 0
  entries.each_pair do |ms,cves|
    cves.each do |cve|       
      existing_cve = NvdEntry.find_by_cve(cve.strip)
      if existing_cve
        Mscve.find_or_create_by_nvd_entry_id_and_name(existing_cve.id, ms)
        puts "Found: #{existing_cve.cve}."
        counter += 1
      end
    end
  end  
  puts "Added #{counter} items to database."
end

Print all MS-Notation numbers mapped to CVE-Entries



35
36
37
38
39
40
41
# File 'lib/cveparser/ms_parser.rb', line 35

def self.print_map
  entries = parse    
  entries.each_pair do |ms,cves|
    puts "#{ms}"
    cves.each {|cve| puts "----#{cve}"}
  end
end