Class: Msf::Analyze::Result

Inherits:
Object
  • Object
show all
Defined in:
lib/msf/core/analyze/result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host:, mod:, framework:, available_creds: nil, datastore: nil) ⇒ Result

Returns a new instance of Result.


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/msf/core/analyze/result.rb', line 10

def initialize(host:, mod:, framework:, available_creds: nil, datastore: nil)
  @host = host
  @mod = mod
  @required = []
  @missing = []
  @invalid = []
  @datastore = datastore&.transform_keys(&:downcase) || Hash.new
  @available_creds = available_creds
  @framework = framework

  determine_likely_compatibility
end

Instance Attribute Details

#datastoreObject (readonly)

Returns the value of attribute datastore


3
4
5
# File 'lib/msf/core/analyze/result.rb', line 3

def datastore
  @datastore
end

#hostObject (readonly)

Returns the value of attribute host


4
5
6
# File 'lib/msf/core/analyze/result.rb', line 4

def host
  @host
end

#invalidObject (readonly)

Returns the value of attribute invalid


5
6
7
# File 'lib/msf/core/analyze/result.rb', line 5

def invalid
  @invalid
end

#missingObject (readonly)

Returns the value of attribute missing


6
7
8
# File 'lib/msf/core/analyze/result.rb', line 6

def missing
  @missing
end

#modObject (readonly)

Returns the value of attribute mod


7
8
9
# File 'lib/msf/core/analyze/result.rb', line 7

def mod
  @mod
end

#requiredObject (readonly)

Returns the value of attribute required


8
9
10
# File 'lib/msf/core/analyze/result.rb', line 8

def required
  @required
end

Instance Method Details

#evaluate(with: @datastore) ⇒ Object


23
24
25
26
27
28
# File 'lib/msf/core/analyze/result.rb', line 23

def evaluate(with: @datastore)
  @datastore = with

  determine_prerequisites
  self
end

#match?Boolean

Returns:

  • (Boolean)

45
46
47
# File 'lib/msf/core/analyze/result.rb', line 45

def match?
  !@missing.include? :os_match
end

#ready_for_test?Boolean

Returns:

  • (Boolean)

49
50
51
# File 'lib/msf/core/analyze/result.rb', line 49

def ready_for_test?
  @prerequisites_evaluated && @missing.empty? && @invalid.empty?
end

#to_sObject


30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/msf/core/analyze/result.rb', line 30

def to_s
  if ready_for_test?
    "ready for testing"
  elsif @missing.empty? && @invalid.empty?
    # TODO? confirm vuln match in this class
    "has matching reference"
  else
    if missing_message.empty? || invalid_message.empty?
      missing_message + invalid_message
    else
      [missing_message, invalid_message].join(', ')
    end
  end
end