Sha256: b0b3fab7aadb7362be37bca33260bf74393ee7b2c7706e488a4e55678dff54ff

Contents?: true

Size: 1.01 KB

Versions: 7

Compression:

Stored size: 1.01 KB

Contents

module CMSScanner
  module Finders
    # Same Type Finders container
    #
    # This class is designed to handle same type results, such as enumeration of plugins,
    # themes etc.
    class SameTypeFinders < IndependentFinders
      # @param [ Hash ] opts
      # @option opts [ Symbol ] :mode :mixed, :passive or :aggressive
      # @option opts [ Boolean ] :vulnerable Only return vulnerable findings
      #                                     (which must respond to :vulnerable?)
      # @option opts [ Boolean ] :sort Wether or not to sort the findings
      #
      # @return [ Findings ]
      def run(opts = {})
        symbols_from_mode(opts[:mode]).each do |symbol|
          each do |finder|
            [*finder.send(symbol, opts.merge(found: findings))].compact.each do |found|
              findings << found
            end
          end
        end

        findings.select!(&:vulnerable?) if opts[:vulnerable]
        findings.sort!                  if opts[:sort]

        findings
      end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
cms_scanner-0.0.23 lib/cms_scanner/finders/same_type_finders.rb
cms_scanner-0.0.22 lib/cms_scanner/finders/same_type_finders.rb
cms_scanner-0.0.21 lib/cms_scanner/finders/same_type_finders.rb
cms_scanner-0.0.20 lib/cms_scanner/finders/same_type_finders.rb
cms_scanner-0.0.19 lib/cms_scanner/finders/same_type_finders.rb
cms_scanner-0.0.18 lib/cms_scanner/finders/same_type_finders.rb
cms_scanner-0.0.17 lib/cms_scanner/finders/same_type_finders.rb