Nokogiri::XML hack to set the default option to NOBLANKS
This commit is contained in:
@@ -23,12 +23,9 @@ class Vulnerable
|
|||||||
|
|
||||||
# @return an array of WpVulnerability (can be empty)
|
# @return an array of WpVulnerability (can be empty)
|
||||||
def vulnerabilities
|
def vulnerabilities
|
||||||
|
xml = Nokogiri::XML(File.open(@vulns_file))
|
||||||
vulnerabilities = []
|
vulnerabilities = []
|
||||||
|
|
||||||
xml = Nokogiri::XML(File.open(@vulns_file)) do |config|
|
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
|
|
||||||
xml.xpath(@vulns_xpath).each do |node|
|
xml.xpath(@vulns_xpath).each do |node|
|
||||||
vulnerabilities << WpVulnerability.new(
|
vulnerabilities << WpVulnerability.new(
|
||||||
node.search('title').text,
|
node.search('title').text,
|
||||||
|
|||||||
@@ -121,9 +121,7 @@ class WpEnumerator
|
|||||||
|
|
||||||
# Timthumbs have no XML file
|
# Timthumbs have no XML file
|
||||||
unless type =~ /timthumbs/i
|
unless type =~ /timthumbs/i
|
||||||
xml = Nokogiri::XML(File.open(vulns_file)) do |config|
|
xml = Nokogiri::XML(File.open(vulns_file))
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
|
|
||||||
# We check if the plugin name from the plugin_vulns_file is already in targets, otherwise we add it
|
# We check if the plugin name from the plugin_vulns_file is already in targets, otherwise we add it
|
||||||
xml.xpath(options[:vulns_xpath_2]).each do |node|
|
xml.xpath(options[:vulns_xpath_2]).each do |node|
|
||||||
|
|||||||
@@ -146,10 +146,7 @@ class WpVersion < Vulnerable
|
|||||||
version_xml = options[:version_xml] || WP_VERSIONS_FILE # needed for rpsec
|
version_xml = options[:version_xml] || WP_VERSIONS_FILE # needed for rpsec
|
||||||
wp_content = options[:wp_content_dir]
|
wp_content = options[:wp_content_dir]
|
||||||
wp_plugins = "#{wp_content}/plugins"
|
wp_plugins = "#{wp_content}/plugins"
|
||||||
|
xml = Nokogiri::XML(File.open(version_xml))
|
||||||
xml = Nokogiri::XML(File.open(version_xml)) do |config|
|
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
|
|
||||||
xml.xpath('//file').each do |node|
|
xml.xpath('//file').each do |node|
|
||||||
file_src = node.attribute('src').text
|
file_src = node.attribute('src').text
|
||||||
|
|||||||
@@ -46,9 +46,7 @@ class CheckerPlugin < Plugin
|
|||||||
puts '[+] Checking vulnerabilities reference urls'
|
puts '[+] Checking vulnerabilities reference urls'
|
||||||
|
|
||||||
vuln_ref_files.each do |vuln_ref_file|
|
vuln_ref_files.each do |vuln_ref_file|
|
||||||
xml = Nokogiri::XML(File.open(vuln_ref_file)) do |config|
|
xml = Nokogiri::XML(File.open(vuln_ref_file))
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
|
|
||||||
urls = []
|
urls = []
|
||||||
xml.xpath('//reference').each { |node| urls << node.text }
|
xml.xpath('//reference').each { |node| urls << node.text }
|
||||||
@@ -113,9 +111,7 @@ class CheckerPlugin < Plugin
|
|||||||
|
|
||||||
puts '[+] Checking for vulnerable files ...'
|
puts '[+] Checking for vulnerable files ...'
|
||||||
|
|
||||||
xml = Nokogiri::XML(File.open(xml_file)) do |config|
|
xml = Nokogiri::XML(File.open(xml_file))
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
|
|
||||||
xml.xpath('//hash').each do |node|
|
xml.xpath('//hash').each do |node|
|
||||||
sha1sum = node.attribute('sha1').text
|
sha1sum = node.attribute('sha1').text
|
||||||
|
|||||||
@@ -44,32 +44,24 @@ class StatsPlugin < Plugin
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def vuln_plugin_count(file=PLUGINS_VULNS_FILE)
|
def xml(file)
|
||||||
xml = Nokogiri::XML(File.open(file)) do |config|
|
Nokogiri::XML(File.open(file))
|
||||||
config.noblanks
|
|
||||||
end
|
end
|
||||||
xml.xpath("count(//plugin)").to_i
|
|
||||||
|
def vuln_plugin_count(file=PLUGINS_VULNS_FILE)
|
||||||
|
self.xml(file).xpath("count(//plugin)").to_i
|
||||||
end
|
end
|
||||||
|
|
||||||
def vuln_theme_count(file=THEMES_VULNS_FILE)
|
def vuln_theme_count(file=THEMES_VULNS_FILE)
|
||||||
xml = Nokogiri::XML(File.open(file)) do |config|
|
self.xml(file).xpath("count(//theme)").to_i
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
xml.xpath("count(//theme)").to_i
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def plugin_vulns_count(file=PLUGINS_VULNS_FILE)
|
def plugin_vulns_count(file=PLUGINS_VULNS_FILE)
|
||||||
xml = Nokogiri::XML(File.open(file)) do |config|
|
self.xml(file).xpath("count(//vulnerability)").to_i
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
xml.xpath("count(//vulnerability)").to_i
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def theme_vulns_count(file=THEMES_VULNS_FILE)
|
def theme_vulns_count(file=THEMES_VULNS_FILE)
|
||||||
xml = Nokogiri::XML(File.open(file)) do |config|
|
self.xml(file).xpath("count(//vulnerability)").to_i
|
||||||
config.noblanks
|
|
||||||
end
|
|
||||||
xml.xpath("count(//vulnerability)").to_i
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def total_plugins(file=PLUGINS_FULL_FILE, xml=PLUGINS_VULNS_FILE)
|
def total_plugins(file=PLUGINS_FULL_FILE, xml=PLUGINS_VULNS_FILE)
|
||||||
|
|||||||
Reference in New Issue
Block a user