Path: blob/master/app/finders/config_backups/known_filenames.rb
485 views
# frozen_string_literal: true12module WPScan3module Finders4module ConfigBackups5# Config Backup finder6class KnownFilenames < CMSScanner::Finders::Finder7include CMSScanner::Finders::Finder::Enumerator89# @param [ Hash ] opts10# @option opts [ String ] :list11# @option opts [ Boolean ] :show_progression12#13# @return [ Array<ConfigBackup> ]14def aggressive(opts = {})15found = []1617enumerate(potential_urls(opts), opts.merge(check_full_response: 200)) do |res|18next unless res.body =~ /define/i && res.body !~ /<\s?html/i1920found << Model::ConfigBackup.new(res.request.url, found_by: DIRECT_ACCESS, confidence: 100)21end2223found24end2526# @param [ Hash ] opts27# @option opts [ String ] :list Mandatory28#29# @return [ Hash ]30def potential_urls(opts = {})31urls = {}3233File.open(opts[:list]).each_with_index do |file, index|34urls[target.url(file.chomp)] = index35end3637urls38end3940def create_progress_bar(opts = {})41super(opts.merge(title: ' Checking Config Backups -'))42end43end44end45end46end474849