class WPScan::DB::DynamicFinders::Wordpress

Public Class Methods

allowed_classes() click to toggle source

@return [ Array<Symbol> ]

# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 18
def self.allowed_classes
  @allowed_classes ||= %i[
    Comment Xpath HeaderPattern BodyPattern JavascriptVar QueryParameter WpItemQueryParameter
  ]
end
create_versions_finders() click to toggle source
# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 54
def self.create_versions_finders
  versions_finders_configs.each do |finder_class, config|
    klass = config['class'] || finder_class

    # Instead of raising exceptions, skip unallowed/already defined finders
    # So that, when new DF configs are put in the .yml
    # users with old version of WPScan will still be able to scan blogs
    # when updating the DB but not the tool
    next if version_finder_module.constants.include?(finder_class.to_sym) ||
            !allowed_classes.include?(klass.to_sym)

    version_finder_super_class(klass).create_child_class(version_finder_module, finder_class.to_sym, config)
  end
end
df_data() click to toggle source

@return [ Hash ]

# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 8
def self.df_data
  @df_data ||= all_df_data['wordpress'] || {}
end
finder_configs(finder_class, aggressive: false) click to toggle source

@param [ Symbol ] finder_class @param [ Boolean ] aggressive @return [ Hash ]

# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 27
def self.finder_configs(finder_class, aggressive: false)
  configs = {}

  return configs unless allowed_classes.include?(finder_class)

  finders = if aggressive
              df_data.reject { |_f, c| c['path'].nil? }
            else
              df_data.select { |_f, c| c['path'].nil? }
            end

  finders.each do |finder_name, config|
    klass = config['class'] || finder_name

    next unless klass.to_sym == finder_class

    configs[finder_name] = config
  end

  configs
end
version_finder_module() click to toggle source

@return [ Constant ]

# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 13
def self.version_finder_module
  Finders::WpVersion
end
version_finder_super_class(klass) click to toggle source

@param [ String, Symbol ] klass @return [ Constant ]

# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 71
def self.version_finder_super_class(klass)
  "WPScan::Finders::DynamicFinder::WpVersion::#{klass}".constantize
end
versions_finders_configs() click to toggle source

@return [ Hash ]

# File lib/wpscan/db/dynamic_finders/wordpress.rb, line 50
def self.versions_finders_configs
  @versions_finders_configs ||= df_data.select { |_finder_name, config| config.key?('version') }
end