Path: blob/master/app/finders/medias/attachment_brute_forcing.rb
485 views
# frozen_string_literal: true12module WPScan3module Finders4module Medias5# Medias Finder, see https://github.com/wpscanteam/wpscan/issues/1726class AttachmentBruteForcing < CMSScanner::Finders::Finder7include CMSScanner::Finders::Finder::Enumerator89# @param [ Hash ] opts10# @option opts [ Range ] :range Mandatory11#12# @return [ Array<Media> ]13def aggressive(opts = {})14found = []1516enumerate(target_urls(opts), opts) do |res|17next unless res.code == 2001819found << Model::Media.new(res.effective_url, opts.merge(found_by: found_by, confidence: 100))20end2122found23end2425# @param [ Hash ] opts26# @option opts [ Range ] :range Mandatory27#28# @return [ Hash ]29def target_urls(opts = {})30urls = {}3132opts[:range].each do |id|33urls[target.uri.join("?attachment_id=#{id}").to_s] = id34end3536urls37end3839def create_progress_bar(opts = {})40super(opts.merge(title: ' Brute Forcing Attachment IDs -'))41end42end43end44end45end464748