#!/usr/bin/env ruby

require 'date'

cve = {}

$stdin.read.split(/^\[Date: /).each do |v|
  lines = v.split(/\n/)
  date = Date.parse(lines[0]) rescue Date.today

  lines.map do |v|
    v.scan(/CVE-[0-9]+-[0-9]+/i)
  end.flatten.filter {|v| v.size > 0 }.each do |v|
    entry = v.upcase
    if !cve[entry]
      puts "#{date} #{entry}"
      cve[entry] = true
    end
  end
end
