Parent

Methods

Files

WpEnumerator

Enumerate over a given set of items and check if they exist

Public Class Methods

enumerate(options = {}) click to toggle source

Enumerate the given Targets

Attributes

  • targets - targets to enumerate

    • :url - Base URL

    • :wp_content - wp-content directory

    • :path - Path to plugin

  • type - "plugins" or "themes", item to enumerate

  • filename - filename in the data directory with paths

  • show_progress_bar - Show a progress bar during enumeration

# File lib/wpscan/wp_enumerator.rb, line 33
def self.enumerate(options = {})

  WpOptions.check_options(options)

  targets = self.generate_items(options)

  found = []
  queue_count = 0
  request_count = 0
  enum_browser = Browser.instance
  enum_hydra = enum_browser.hydra
  enumerate_size = targets.size

  targets.each do |target|
    url = target.get_url
    request = enum_browser.forge_request(url, :cache_timeout => 0, :follow_location => true)
    request_count += 1

    request.on_complete do |response|
      if options[:show_progress_bar]
        print "\rChecking for #{enumerate_size} total #{options[:type]}... #{(request_count * 100) / enumerate_size}% complete."
      end
      if WpTarget.valid_response_codes.include?(response.code)
        if Digest::MD5.hexdigest(response.body) != options[:error_404_hash]
          found << target
        end
      end
    end

    enum_hydra.queue(request)
    queue_count += 1

    if queue_count == enum_browser.max_threads
      enum_hydra.run
      queue_count = 0
    end
  end

  enum_hydra.run
  found
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.