New enumeration system
This commit is contained in:
26
lib/common/models/wp_item/vulnerable.rb
Executable file
26
lib/common/models/wp_item/vulnerable.rb
Executable file
@@ -0,0 +1,26 @@
|
||||
# encoding: UTF-8
|
||||
|
||||
class WpItem
|
||||
|
||||
# moved this into the module ?
|
||||
def vulns_file=(file)
|
||||
if File.exists?(file)
|
||||
@vulns_file = file
|
||||
else
|
||||
raise "The file #{file} does not exist"
|
||||
end
|
||||
end
|
||||
|
||||
module Vulnerable
|
||||
# @return [ Vulnerabilities ]
|
||||
def vulnerabilities
|
||||
xml = xml(vulns_file)
|
||||
vulnerabilities = Vulnerabilities.new
|
||||
|
||||
xml.xpath(vulns_xpath).each do |node|
|
||||
vulnerabilities << Vulnerability.load_from_xml_node(node)
|
||||
end
|
||||
vulnerabilities
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user