Exception: Msf::Modules::VersionCompatibilityError

Inherits:
Error
  • Object
show all
Defined in:
lib/msf/core/modules/version_compatibility_error.rb

Overview

Error raised by Namespace#version_compatible! on Loader::Base#create_namespace_module if the API or Core version does not meet the minimum requirements defined in the RequiredVersions constant in the module content.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ VersionCompatibilityError

Returns a new instance of VersionCompatibilityError

Options Hash (attributes):


12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/msf/core/modules/version_compatibility_error.rb', line 12

def initialize(attributes={})
  @minimum_api_version = attributes[:minimum_api_version]
  @minimum_core_version = attributes[:minimum_core_version]

  message_parts = []
  message_parts << 'version check'

  if minimum_api_version or minimum_core_version
    clause_parts = []

    if minimum_api_version
      clause_parts << "API >= #{minimum_api_version}"
    end

    if minimum_core_version
      clause_parts << "Core >= #{minimum_core_version}"
    end

    clause = clause_parts.join(' and ')
    message_parts << "(requires #{clause})"
  end

  causal_message = message_parts.join(' ')

  super_attributes = {
      :causal_message => causal_message
  }.merge(attributes)

  super(super_attributes)
end

Instance Attribute Details

#minimum_api_versionFloat (readonly)


44
45
46
# File 'lib/msf/core/modules/version_compatibility_error.rb', line 44

def minimum_api_version
  @minimum_api_version
end

#minimum_core_versionFloat (readonly)


46
47
48
# File 'lib/msf/core/modules/version_compatibility_error.rb', line 46

def minimum_core_version
  @minimum_core_version
end

#module_pathString (readonly)


48
49
50
# File 'lib/msf/core/modules/version_compatibility_error.rb', line 48

def module_path
  @module_path
end

#module_reference_nameString (readonly)


50
51
52
# File 'lib/msf/core/modules/version_compatibility_error.rb', line 50

def module_reference_name
  @module_reference_name
end