# class StatsPlugin

### Public Class Methods

new() click to toggle source
Calls superclass method Plugin.new

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 4
    def initialize
      super(author: 'WPScanTeam - Christian Mehlmauer')

      register_options(
          ['--stats', '--s', 'Show WpScan Database statistics']
      )
    end

### Public Instance Methods

lines_in_file(file) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 50
    def lines_in_file(file)
      IO.readlines(file).size
    end

plugin_vulns_count(file=PLUGINS_VULNS_FILE) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 34
    def plugin_vulns_count(file=PLUGINS_VULNS_FILE)
      xml(file).xpath("count(//vulnerability)").to_i
    end

run(options = {}) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 12
    def run(options = {})
      if options[:stats]
        puts "Wpscan Databse Statistics:"
        puts "--------------------------"
        puts "[#] Total vulnerable plugins: #{vuln_plugin_count}"
        puts "[#] Total vulnerable themes: #{vuln_theme_count}"
        puts "[#] Total plugin vulnerabilities: #{plugin_vulns_count}"
        puts "[#] Total theme vulnerabilities: #{theme_vulns_count}"
        puts "[#] Total plugins to enumerate: #{total_plugins}"
        puts "[#] Total themes to enumerate: #{total_themes}"
        puts
      end
    end

theme_vulns_count(file=THEMES_VULNS_FILE) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 38
    def theme_vulns_count(file=THEMES_VULNS_FILE)
      xml(file).xpath("count(//vulnerability)").to_i
    end

total_plugins(file=PLUGINS_FULL_FILE) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 42
    def total_plugins(file=PLUGINS_FULL_FILE)
      lines_in_file(file)
    end

total_themes(file=THEMES_FULL_FILE) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 46
    def total_themes(file=THEMES_FULL_FILE)
      lines_in_file(file)
    end

vuln_plugin_count(file=PLUGINS_VULNS_FILE) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 26
    def vuln_plugin_count(file=PLUGINS_VULNS_FILE)
      xml(file).xpath("count(//plugin)").to_i
    end

vuln_theme_count(file=THEMES_VULNS_FILE) click to toggle source

    # File lib/wpstools/plugins/stats/stats_plugin.rb, line 30
    def vuln_theme_count(file=THEMES_VULNS_FILE)
      xml(file).xpath("count(//theme)").to_i
    end