class CMSScanner::Finders::BaseFinders

Base class container for the Finders (i.e IndependentFinders etc)

Public Instance Methods

findings() click to toggle source

@return [ Findings ]

# File lib/cms_scanner/finders/base_finders.rb, line 8
def findings
  @findings ||= NS::Finders::Findings.new
end
run() click to toggle source

Should be implemented in child classes

# File lib/cms_scanner/finders/base_finders.rb, line 13
def run; end

Protected Instance Methods

filter_findings() click to toggle source

Allow child classes to filter the findings, such as return the best one or remove the low confidence ones.

@return [ Findings ]

# File lib/cms_scanner/finders/base_finders.rb, line 40
def filter_findings
  findings
end
run_finder(finder, symbol, opts) click to toggle source

@param [ CMSScanner::Finders::Finder ] finder @param [ Symbol ] symbol See return values of symbols_from_mode @param [ Hash ] opts

# File lib/cms_scanner/finders/base_finders.rb, line 30
def run_finder(finder, symbol, opts)
  Array(finder.send(symbol, opts.merge(found: findings))).compact.each do |found|
    findings << found
  end
end
symbols_from_mode(mode) click to toggle source

@param [ Symbol ] mode :mixed, :passive or :aggressive @return [ Array<Symbol> ] The symbols to call for the mode

# File lib/cms_scanner/finders/base_finders.rb, line 19
def symbols_from_mode(mode)
  symbols = %i[passive aggressive]

  return symbols if mode.nil? || mode == :mixed

  symbols.include?(mode) ? Array(mode) : []
end