Class: CMSScanner::Finders::UniqueFinders

Inherits:
BaseFinders
  • Object
show all
Defined in:
lib/cms_scanner/finders/unique_finders.rb

Overview

This class is designed to return a unique result such as a version Note: Finders contained can return multiple results but the #run will only returned the best finding

Instance Method Summary collapse

Methods inherited from BaseFinders

#findings

Instance Method Details

#run(opts = {}) ⇒ Object, false

Returns The best finding or false if none.

Parameters:

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

Options Hash (opts):

  • :mode (Symbol)

    :mixed, :passive or :aggressive

  • :confidence_threshold (Int)

    If a finding’s confidence reaches this value, it will be returned as the best finding. Default is 100. If <= 0, all finders will be ran.

Returns:

  • (Object, false)

    The best finding or false if none



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/cms_scanner/finders/unique_finders.rb', line 17

def run(opts = {})
  opts[:confidence_threshold] ||= 100

  symbols_from_mode(opts[:mode]).each do |symbol|
    each do |finder|
      run_finder(finder, symbol, opts)

      next if opts[:confidence_threshold] <= 0

      findings.each { |f| return f if f.confidence >= opts[:confidence_threshold] }
    end
  end

  filter_findings
end