made a command line program to query a pkg name and return back cves and also a way to list all the pkgs in the xml file

This commit is contained in:
booboy 2020-10-25 03:55:41 -05:00
parent acf1bc223f
commit 40dedfb707
2 changed files with 95587 additions and 5047 deletions

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,34 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
require 'optparse'
require 'pry'
require 'pp'
require './rhel_rpm_to_cve'
data_file = './rpm-to-cve.xml'
options = {}
parser = OptionParser.new do |parser|
parser.banner = 'Usage: rpm_pkg_audit.rb [options]'
parser.on('-p', '--pkg PKGNAME', 'The pkg name you want to audit.') do |pkg|
options[:pkg] = pkg
end
parser.on('-l', '--list', 'List packages in the XML datafile.') do |list|
options[:list] = list
end
end
parser.parse!
pkg_name = options[:pkg]
rpm_auditer = RhelRpmToCve.new(data_file)
if rpm_auditer.pkg_exists?(pkg_name)
pp rpm_auditer.cves_per_pkg_name(pkg_name)
elsif options.key?(:list)
puts rpm_auditer.list_pkg_names
else
puts 'Package not found.'
end