Class: WPScan::Finders::BackupFolders::KnownLocations
- Includes:
- Finder::Enumerator
- Defined in:
- app/finders/backup_folders/known_locations.rb
Overview
Backup Folders finder
Constant Summary
Constants inherited from Finder
Instance Attribute Summary
Attributes inherited from Finder
Instance Method Summary collapse
- #aggressive(opts = {}) ⇒ Array<BackupFolder>
- #create_progress_bar(opts = {}) ⇒ Object
- #potential_urls(opts = {}) ⇒ Hash
- #valid_response_codes ⇒ Array<Integer>
Methods included from Finder::Enumerator
#enumerate, #full_request_params, #head_or_get_request_params, #maybe_get_full_response
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<BackupFolder>
20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/finders/backup_folders/known_locations.rb', line 20 def aggressive(opts = {}) found = [] enumerate(potential_urls(opts), opts.merge(check_full_response: valid_response_codes)) do |res| next if target.homepage_or_404?(res) # Only report if directory listing is enabled (makes finding actionable) next unless target.directory_listing?(res.request.url) found << Model::BackupFolder.new( res.request.url, confidence: 100, # Directory listing enabled - definite finding found_by: DIRECT_ACCESS, interesting_entries: target.directory_listing_entries(res.request.url) ) end found end |
#create_progress_bar(opts = {}) ⇒ Object
60 61 62 |
# File 'app/finders/backup_folders/known_locations.rb', line 60 def (opts = {}) super(opts.merge(title: ' Checking Backup Folders -')) end |
#potential_urls(opts = {}) ⇒ Hash
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/finders/backup_folders/known_locations.rb', line 44 def potential_urls(opts = {}) urls = {} content_base = target.content_dir || 'wp-content' File.open(opts[:list]) do |f| f.each_with_index do |line, index| path = line.chomp.strip next if path.empty? || path.start_with?('#') urls[target.url("#{content_base}/#{path}")] = index end end urls end |
#valid_response_codes ⇒ Array<Integer>
11 12 13 |
# File 'app/finders/backup_folders/known_locations.rb', line 11 def valid_response_codes @valid_response_codes ||= [200].freeze end |