Class: CMSScanner::Finders::SameTypeFinders

Inherits:
IndependentFinders show all
Defined in:
lib/cms_scanner/finders/same_type_finders.rb

Overview

Same Type Finders container

This class is designed to handle same type results, such as enumeration of plugins, themes etc.

Instance Method Summary collapse

Methods inherited from IndependentFinders

#findings, #symbols_from_mode

Instance Method Details

#run(opts = {}) ⇒ Findings

Parameters:

  • opts (Hash) (defaults to: {})

Options Hash (opts):

  • :mode (Symbol)

    :mixed, :passive or :aggressive

  • :vulnerable (Boolean)

    Only return vulnerable findings (which must respond to :vulnerable?)

  • :sort (Boolean)

    Wether or not to sort the findings

Returns:



15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/cms_scanner/finders/same_type_finders.rb', line 15

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