Yak Shaving

just me

A little Ruby

without comments

I wrote a little ruby a while back to interpret the data from National Vulnerability Database

require 'net/http'
require 'rexml/document'

include REXML

#url = 'http://static.nvd.nist.gov/feeds/xml/cve/nvdcve-2.0-recent.xml'

# get the XML data as a string
#xml_data = Net::HTTP.get_response(URI.parse(url)).body

# for download
#doc = REXML::Document.new(xml_data)

file = File.open("recent.xml")

doc = Document.new(file)

doc.elements.each('nvd/entry') do |entry|
	print entry.elements["vuln:cve-id"].text
	print " ==> "
	if entry.elements["vuln:cwe"]
		puts entry.elements["vuln:cwe"].attributes['id']
	else
		puts ""
	end
end

Written by channam

February 24th, 2009 at 3:01 pm

Posted in Uncategorized

Leave a Reply