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, payloads: nil, datastore: nil) ⇒ Result

Returns a new instance of Result.



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

def initialize(host:, mod:, framework:, available_creds: nil, payloads: nil, datastore: nil)
  @host = host
  @mod = mod
  @required = []
  @missing = []
  @invalid = []
  @datastore = datastore&.transform_keys(&:downcase) || Hash.new
  @available_creds = available_creds
  @wanted_payloads = payloads
  @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, payloads: @wanted_payloads) ⇒ Object



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

def evaluate(with: @datastore, payloads: @wanted_payloads)
  @datastore = with
  @wanted_payloads = payloads

  determine_prerequisites
  self
end

#match?Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/msf/core/analyze/result.rb', line 47

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

#ready_for_test?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/msf/core/analyze/result.rb', line 51

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

#to_sObject



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

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