Creation of a function xml instead of a hack for Nokogiri::XML
This commit is contained in:
@@ -46,7 +46,7 @@ class CheckerPlugin < Plugin
|
||||
puts '[+] Checking vulnerabilities reference urls'
|
||||
|
||||
vuln_ref_files.each do |vuln_ref_file|
|
||||
xml = Nokogiri::XML(File.open(vuln_ref_file))
|
||||
xml = xml(vuln_ref_file)
|
||||
|
||||
urls = []
|
||||
xml.xpath('//reference').each { |node| urls << node.text }
|
||||
@@ -111,7 +111,7 @@ class CheckerPlugin < Plugin
|
||||
|
||||
puts '[+] Checking for vulnerable files ...'
|
||||
|
||||
xml = Nokogiri::XML(File.open(xml_file))
|
||||
xml = xml(xml_file)
|
||||
|
||||
xml.xpath('//hash').each do |node|
|
||||
sha1sum = node.attribute('sha1').text
|
||||
|
||||
@@ -44,24 +44,20 @@ class StatsPlugin < Plugin
|
||||
end
|
||||
end
|
||||
|
||||
def xml(file)
|
||||
Nokogiri::XML(File.open(file))
|
||||
end
|
||||
|
||||
def vuln_plugin_count(file=PLUGINS_VULNS_FILE)
|
||||
self.xml(file).xpath("count(//plugin)").to_i
|
||||
xml(file).xpath("count(//plugin)").to_i
|
||||
end
|
||||
|
||||
def vuln_theme_count(file=THEMES_VULNS_FILE)
|
||||
self.xml(file).xpath("count(//theme)").to_i
|
||||
xml(file).xpath("count(//theme)").to_i
|
||||
end
|
||||
|
||||
def plugin_vulns_count(file=PLUGINS_VULNS_FILE)
|
||||
self.xml(file).xpath("count(//vulnerability)").to_i
|
||||
xml(file).xpath("count(//vulnerability)").to_i
|
||||
end
|
||||
|
||||
def theme_vulns_count(file=THEMES_VULNS_FILE)
|
||||
self.xml(file).xpath("count(//vulnerability)").to_i
|
||||
xml(file).xpath("count(//vulnerability)").to_i
|
||||
end
|
||||
|
||||
def total_plugins(file=PLUGINS_FULL_FILE, xml=PLUGINS_VULNS_FILE)
|
||||
|
||||
Reference in New Issue
Block a user