Class: WPScan::Finders::ConfigBackups::KnownFilenames

Inherits:
Finder
  • Object
show all
Includes:
Finder::Enumerator
Defined in:
app/finders/config_backups/known_filenames.rb

Overview

Config Backup finder

Constant Summary

Constants inherited from Finder

Finder::DIRECT_ACCESS

Instance Attribute Summary

Attributes inherited from Finder

#progress_bar, #target

Instance Method Summary collapse

Methods included from Finder::Enumerator

#enumerate, #full_request_params, #head_or_get_request_params, #maybe_get_full_response, #valid_response_codes

Methods inherited from Finder

#browser, #found_by, #hydra, #initialize, #passive, #titleize

Constructor Details

This class inherits a constructor from WPScan::Finders::Finder

Instance Method Details

#aggressive(opts = {}) ⇒ Array<ConfigBackup>

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :list (String)
  • :show_progression (Boolean)

Returns:

  • (Array<ConfigBackup>)


15
16
17
18
19
20
21
22
23
24
25
# File 'app/finders/config_backups/known_filenames.rb', line 15

def aggressive(opts = {})
  found = []

  enumerate(potential_urls(opts), opts.merge(check_full_response: 200)) do |res|
    next unless res.body =~ /define/i && res.body !~ /<\s?html/i

    found << Model::ConfigBackup.new(res.request.url, found_by: DIRECT_ACCESS, confidence: 100)
  end

  found
end

#create_progress_bar(opts = {}) ⇒ Object



43
44
45
# File 'app/finders/config_backups/known_filenames.rb', line 43

def create_progress_bar(opts = {})
  super(opts.merge(title: ' Checking Config Backups -'))
end

#potential_urls(opts = {}) ⇒ Hash

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :list (String)

    Mandatory

Returns:

  • (Hash)


31
32
33
34
35
36
37
38
39
40
41
# File 'app/finders/config_backups/known_filenames.rb', line 31

def potential_urls(opts = {})
  urls = {}

  File.open(opts[:list]) do |f|
    f.each_with_index do |file, index|
      urls[target.url(file.chomp)] = index
    end
  end

  urls
end