starting to script out a way to download nvd data
This commit is contained in:
parent
30a10892eb
commit
7ba4928770
2 changed files with 33 additions and 1 deletions
|
@ -1,2 +1,4 @@
|
|||
class CveInfo
|
||||
end
|
||||
def initialize
|
||||
end
|
||||
end
|
30
classes/nvd_downloader.rb
Normal file
30
classes/nvd_downloader.rb
Normal file
|
@ -0,0 +1,30 @@
|
|||
require 'rest-client'
|
||||
|
||||
class NvdDownloader
|
||||
attr_accessor :base_url, :years
|
||||
|
||||
MIN_YEAR = '2002'
|
||||
MAX_YEAR = '2019'
|
||||
AVAILABLE_YEARS = (MIN_YEAR..MAX_YEAR).to_a
|
||||
|
||||
def initialize
|
||||
@base_url = "https://nvd.nist.gov/feeds/json/cve/1.0/"
|
||||
@years = self.years
|
||||
end
|
||||
|
||||
def years
|
||||
year = NvdDownloader::AVAILABLE_YEARS.map do |year|
|
||||
[year.to_i, year]
|
||||
end.to_h
|
||||
end
|
||||
|
||||
def year(year)
|
||||
years[year]
|
||||
end
|
||||
|
||||
|
||||
def get(url)
|
||||
|
||||
end
|
||||
|
||||
end
|
Loading…
Add table
Reference in a new issue