Sha256: f3a754624b17517ed9098f8fb13751ef19f95944a00c6cf21c4eecfee137835d

Contents?: true

Size: 1.58 KB

Versions: 1

Compression:

Stored size: 1.58 KB

Contents

require_relative 'enumeration/cli_options'
require_relative 'enumeration/enum_methods'

module WPScan
  module Controller
    # Enumeration Controller
    class Enumeration < CMSScanner::Controller::Base
      def before_scan
        # Create the Dynamic Finders
        DB::DynamicPluginFinders.db_data.each do |name, config|
          %w[Comments].each do |klass|
            next unless config[klass] && config[klass]['version']

            constant_name = name.tr('-', '_').camelize

            unless Finders::PluginVersion.constants.include?(constant_name.to_sym)
              Finders::PluginVersion.const_set(constant_name, Module.new)
            end

            mod = WPScan::Finders::PluginVersion.const_get(constant_name)

            raise "#{mod} has already a #{klass} class" if mod.constants.include?(klass.to_sym)

            case klass
            when 'Comments' then create_plugins_comments_finders(mod, config[klass])
            end
          end
        end
      end

      def create_plugins_comments_finders(mod, config)
        mod.const_set(
          :Comments, Class.new(Finders::Finder::PluginVersion::Comments) do
            const_set(:PATTERN, Regexp.new(config['pattern'], Regexp::IGNORECASE))
          end
        )
      end

      def run
        enum = parsed_options[:enumerate] || {}

        enum_plugins if enum_plugins?(enum)
        enum_themes  if enum_themes?(enum)

        %i[timthumbs config_backups medias].each do |key|
          send("enum_#{key}".to_sym) if enum.key?(key)
        end

        enum_users if enum_users?(enum)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wpscan-3.0.4 app/controllers/enumeration.rb