Module: CMSScanner::Finders::Finding

Included in:
InterestingFinding, User, Version
Defined in:
lib/cms_scanner/finders/finding.rb

Overview

Finding

Constant Summary collapse

FINDING_OPTS =
%i[confidence confirmed_by references found_by interesting_entries].freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object

Fix for “Double/Dynamic Inclusion Problem”



6
7
8
9
# File 'lib/cms_scanner/finders/finding.rb', line 6

def self.included(base)
  base.include References
  super(base)
end

Instance Method Details

#<=>(other) ⇒ Object



47
48
49
# File 'lib/cms_scanner/finders/finding.rb', line 47

def <=>(other)
  to_s.downcase <=> other.to_s.downcase
end

#confidenceInteger

Returns:

  • (Integer)


27
28
29
# File 'lib/cms_scanner/finders/finding.rb', line 27

def confidence
  @confidence ||= 0
end

#confidence=(value) ⇒ Object

Parameters:

  • value (Integer)


32
33
34
# File 'lib/cms_scanner/finders/finding.rb', line 32

def confidence=(value)
  @confidence = value >= 100 ? 100 : value
end

#confirmed_byArray

Returns:

  • (Array)


16
17
18
# File 'lib/cms_scanner/finders/finding.rb', line 16

def confirmed_by
  @confirmed_by ||= []
end

#eql?(other) ⇒ Boolean

TODO: maybe also check for interesting_entries and confirmed_by ? So far this is used in specs only

Returns:

  • (Boolean)


43
44
45
# File 'lib/cms_scanner/finders/finding.rb', line 43

def eql?(other)
  self == other && confidence == other.confidence && found_by == other.found_by
end

#interesting_entriesArray

Should be overriden in child classes

Returns:

  • (Array)


22
23
24
# File 'lib/cms_scanner/finders/finding.rb', line 22

def interesting_entries
  @interesting_entries ||= []
end

#parse_finding_options(opts = {}) ⇒ Object

Parameters:

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


37
38
39
# File 'lib/cms_scanner/finders/finding.rb', line 37

def parse_finding_options(opts = {})
  FINDING_OPTS.each { |opt| send("#{opt}=", opts[opt]) if opts.key?(opt) }
end