diff --git a/lib/wpscan/modules/wp_plugins.rb b/lib/wpscan/modules/wp_plugins.rb index f1634cc7..17a7190b 100644 --- a/lib/wpscan/modules/wp_plugins.rb +++ b/lib/wpscan/modules/wp_plugins.rb @@ -69,4 +69,10 @@ module WpPlugins plugins.sort_by { |p| p.name } end + def plugin_vulns_count(file=PLUGINS_VULNS_FILE) + xml = Nokogiri::XML(File.open(file)) do |config| + config.noblanks + end + xml.xpath("count(//plugin)").to_i + end end diff --git a/lib/wpscan/modules/wp_themes.rb b/lib/wpscan/modules/wp_themes.rb index 3a9d0a7d..9dd4f33b 100644 --- a/lib/wpscan/modules/wp_themes.rb +++ b/lib/wpscan/modules/wp_themes.rb @@ -56,4 +56,10 @@ module WpThemes themes.sort_by { |t| t.name } end + def theme_vulns_count(file=THEMES_VULNS_FILE) + xml = Nokogiri::XML(File.open(file)) do |config| + config.noblanks + end + xml.xpath("count(//theme)").to_i + end end diff --git a/spec/lib/wpscan/modules/wp_plugins_spec.rb b/spec/lib/wpscan/modules/wp_plugins_spec.rb index eaa6cb9b..809f2663 100644 --- a/spec/lib/wpscan/modules/wp_plugins_spec.rb +++ b/spec/lib/wpscan/modules/wp_plugins_spec.rb @@ -192,6 +192,12 @@ shared_examples_for 'WpPlugins' do @expected_plugins = [plugins[1]] end + end + describe '#plugin_vulns_count' do + it 'should return the correct number' do + xml = "#{SPEC_FIXTURES_WPSCAN_WP_PLUGIN_DIR}/vulnerabilities/plugin_vulns.xml" + @module.plugin_vulns_count(xml).should === 2 + end end end diff --git a/spec/lib/wpscan/modules/wp_themes_spec.rb b/spec/lib/wpscan/modules/wp_themes_spec.rb index 2bed6891..4b8725c5 100644 --- a/spec/lib/wpscan/modules/wp_themes_spec.rb +++ b/spec/lib/wpscan/modules/wp_themes_spec.rb @@ -207,4 +207,11 @@ shared_examples_for 'WpThemes' do end end end + + describe '#theme_vulns_count' do + it 'should return the correct number' do + xml = "#{SPEC_FIXTURES_WPSCAN_WP_THEME_DIR}/vulnerabilities/theme_vulns.xml" + @module.theme_vulns_count(xml).should === 2 + end + end end diff --git a/spec/lib/wpscan/wp_theme_spec.rb b/spec/lib/wpscan/wp_theme_spec.rb index 2d04bcc7..a4698a51 100644 --- a/spec/lib/wpscan/wp_theme_spec.rb +++ b/spec/lib/wpscan/wp_theme_spec.rb @@ -285,4 +285,5 @@ describe WpTheme do (instance === instance2).should == true end end + end diff --git a/spec/samples/wpscan/wp_theme/vulnerabilities/theme_vulns.xml b/spec/samples/wpscan/wp_theme/vulnerabilities/theme_vulns.xml new file mode 100644 index 00000000..0b64d85e --- /dev/null +++ b/spec/samples/wpscan/wp_theme/vulnerabilities/theme_vulns.xml @@ -0,0 +1,17 @@ + + + + + onepagewebsite Full Path Disclosure vulnerability + http://1337day.com/exploit/20027 + FPD + + + + + vithy Full Path Disclosure vulnerability + http://1337day.com/exploit/20040 + FPD + + + diff --git a/wpscan.rb b/wpscan.rb index c4245719..6901474c 100755 --- a/wpscan.rb +++ b/wpscan.rb @@ -146,6 +146,8 @@ begin start_time = Time.now puts "| URL: #{wp_target.url}" puts "| Started on #{start_time.asctime}" + puts "| Total vulnerable plugins: #{wp_target.plugin_vulns_count}" + puts "| Total vulnerable themes: #{wp_target.theme_vulns_count}" puts if wp_target.has_robots?