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

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

Overview

Config Backup finder

Instance Method Summary collapse

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



41
42
43
# File 'app/finders/config_backups/known_filenames.rb', line 41

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
# File 'app/finders/config_backups/known_filenames.rb', line 31

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

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

  urls
end