metasploit-model 0.27.3-java → 0.27.4-java

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (127) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +1 -1
  3. data/app/models/metasploit/model/association/reflection.rb +0 -3
  4. data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -3
  5. data/app/models/metasploit/model/module/class/spec/template.rb +0 -4
  6. data/app/models/metasploit/model/module/instance/spec/template.rb +0 -4
  7. data/app/models/metasploit/model/search/group/base.rb +0 -3
  8. data/app/models/metasploit/model/search/group/intersection.rb +0 -3
  9. data/app/models/metasploit/model/search/group/union.rb +0 -3
  10. data/app/models/metasploit/model/search/operation/association.rb +0 -2
  11. data/app/models/metasploit/model/search/operation/base.rb +0 -3
  12. data/app/models/metasploit/model/search/operation/boolean.rb +0 -2
  13. data/app/models/metasploit/model/search/operation/date.rb +0 -2
  14. data/app/models/metasploit/model/search/operation/group/base.rb +0 -2
  15. data/app/models/metasploit/model/search/operation/group/intersection.rb +0 -2
  16. data/app/models/metasploit/model/search/operation/group/union.rb +0 -2
  17. data/app/models/metasploit/model/search/operation/integer.rb +1 -5
  18. data/app/models/metasploit/model/search/operation/null.rb +0 -2
  19. data/app/models/metasploit/model/search/operation/set.rb +5 -2
  20. data/app/models/metasploit/model/search/operation/set/integer.rb +1 -3
  21. data/app/models/metasploit/model/search/operation/set/string.rb +1 -3
  22. data/app/models/metasploit/model/search/operation/string.rb +1 -5
  23. data/app/models/metasploit/model/search/operator/association.rb +0 -2
  24. data/app/models/metasploit/model/search/operator/attribute.rb +0 -2
  25. data/app/models/metasploit/model/search/operator/base.rb +0 -4
  26. data/app/models/metasploit/model/search/operator/delegation.rb +0 -2
  27. data/app/models/metasploit/model/search/operator/deprecated/app.rb +0 -2
  28. data/app/models/metasploit/model/search/operator/deprecated/author.rb +0 -2
  29. data/app/models/metasploit/model/search/operator/deprecated/authority.rb +0 -2
  30. data/app/models/metasploit/model/search/operator/deprecated/platform.rb +0 -2
  31. data/app/models/metasploit/model/search/operator/deprecated/ref.rb +0 -2
  32. data/app/models/metasploit/model/search/operator/deprecated/text.rb +0 -2
  33. data/app/models/metasploit/model/search/operator/group/base.rb +0 -2
  34. data/app/models/metasploit/model/search/operator/group/intersection.rb +0 -2
  35. data/app/models/metasploit/model/search/operator/group/union.rb +0 -2
  36. data/app/models/metasploit/model/search/operator/null.rb +0 -2
  37. data/app/models/metasploit/model/search/operator/single.rb +0 -2
  38. data/app/models/metasploit/model/search/query.rb +0 -3
  39. data/app/models/metasploit/model/spec/template.rb +0 -3
  40. data/app/models/metasploit/model/visitation/visitor.rb +0 -3
  41. data/lib/metasploit/model.rb +14 -8
  42. data/lib/metasploit/model/architecture.rb +320 -326
  43. data/lib/metasploit/model/association.rb +43 -46
  44. data/lib/metasploit/model/association/error.rb +29 -33
  45. data/lib/metasploit/model/association/tree.rb +119 -125
  46. data/lib/metasploit/model/author.rb +45 -51
  47. data/lib/metasploit/model/authority.rb +139 -146
  48. data/lib/metasploit/model/authority/bid.rb +0 -2
  49. data/lib/metasploit/model/authority/cve.rb +0 -2
  50. data/lib/metasploit/model/authority/msb.rb +0 -2
  51. data/lib/metasploit/model/authority/osvdb.rb +0 -2
  52. data/lib/metasploit/model/authority/pmasa.rb +0 -2
  53. data/lib/metasploit/model/authority/secunia.rb +0 -2
  54. data/lib/metasploit/model/authority/us_cert_vu.rb +0 -2
  55. data/lib/metasploit/model/authority/waraxe.rb +0 -2
  56. data/lib/metasploit/model/authority/zdi.rb +0 -2
  57. data/lib/metasploit/model/base.rb +0 -2
  58. data/lib/metasploit/model/derivation.rb +95 -99
  59. data/lib/metasploit/model/derivation/full_name.rb +16 -22
  60. data/lib/metasploit/model/email_address.rb +122 -128
  61. data/lib/metasploit/model/engine.rb +26 -21
  62. data/lib/metasploit/model/error.rb +3 -7
  63. data/lib/metasploit/model/file.rb +0 -2
  64. data/lib/metasploit/model/invalid.rb +11 -17
  65. data/lib/metasploit/model/login.rb +0 -3
  66. data/lib/metasploit/model/login/status.rb +0 -2
  67. data/lib/metasploit/model/module.rb +19 -23
  68. data/lib/metasploit/model/module/action.rb +50 -58
  69. data/lib/metasploit/model/module/ancestor.rb +456 -465
  70. data/lib/metasploit/model/module/ancestor/spec.rb +3 -2
  71. data/lib/metasploit/model/module/architecture.rb +27 -35
  72. data/lib/metasploit/model/module/author.rb +38 -47
  73. data/lib/metasploit/model/module/class.rb +358 -366
  74. data/lib/metasploit/model/module/class/spec.rb +3 -2
  75. data/lib/metasploit/model/module/handler.rb +28 -34
  76. data/lib/metasploit/model/module/instance.rb +586 -596
  77. data/lib/metasploit/model/module/instance/spec.rb +3 -2
  78. data/lib/metasploit/model/module/path.rb +157 -166
  79. data/lib/metasploit/model/module/platform.rb +25 -33
  80. data/lib/metasploit/model/module/rank.rb +71 -79
  81. data/lib/metasploit/model/module/reference.rb +25 -33
  82. data/lib/metasploit/model/module/stance.rb +15 -21
  83. data/lib/metasploit/model/module/target.rb +76 -84
  84. data/lib/metasploit/model/module/target/architecture.rb +27 -37
  85. data/lib/metasploit/model/module/target/platform.rb +27 -37
  86. data/lib/metasploit/model/module/type.rb +35 -41
  87. data/lib/metasploit/model/nilify_blanks.rb +39 -43
  88. data/lib/metasploit/model/platform.rb +231 -237
  89. data/lib/metasploit/model/real_pathname.rb +12 -16
  90. data/lib/metasploit/model/realm.rb +0 -2
  91. data/lib/metasploit/model/realm/key.rb +0 -2
  92. data/lib/metasploit/model/reference.rb +102 -108
  93. data/lib/metasploit/model/search.rb +94 -97
  94. data/lib/metasploit/model/search/association.rb +163 -169
  95. data/lib/metasploit/model/search/attribute.rb +131 -139
  96. data/lib/metasploit/model/search/group.rb +5 -2
  97. data/lib/metasploit/model/search/operation.rb +32 -29
  98. data/lib/metasploit/model/search/operation/group.rb +5 -2
  99. data/lib/metasploit/model/search/operation/value.rb +7 -0
  100. data/lib/metasploit/model/search/operation/{integer/value.rb → value/integer.rb} +1 -1
  101. data/lib/metasploit/model/search/operation/{string/value.rb → value/string.rb} +1 -1
  102. data/lib/metasploit/model/search/operator.rb +65 -65
  103. data/lib/metasploit/model/search/operator/deprecated.rb +8 -2
  104. data/lib/metasploit/model/search/operator/group.rb +5 -2
  105. data/lib/metasploit/model/search/operator/help.rb +71 -79
  106. data/lib/metasploit/model/search/with.rb +72 -78
  107. data/lib/metasploit/model/spec.rb +133 -136
  108. data/lib/metasploit/model/spec/error.rb +3 -9
  109. data/lib/metasploit/model/spec/i18n_exception_handler.rb +0 -2
  110. data/lib/metasploit/model/spec/pathname_collision.rb +19 -27
  111. data/lib/metasploit/model/spec/template/write.rb +0 -2
  112. data/lib/metasploit/model/spec/temporary_pathname.rb +47 -56
  113. data/lib/metasploit/model/translation.rb +0 -2
  114. data/lib/metasploit/model/version.rb +1 -1
  115. data/lib/metasploit/model/visitation.rb +7 -10
  116. data/lib/metasploit/model/visitation/visit.rb +79 -85
  117. data/metasploit-model.gemspec +1 -1
  118. data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +1 -1
  119. data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +1 -1
  120. data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +1 -1
  121. data/spec/app/models/metasploit/model/search/operation/string_spec.rb +1 -1
  122. data/spec/dummy/config/application.rb +1 -0
  123. data/spec/lib/metasploit/model/search/operation/{integer/value_spec.rb → value/integer_spec.rb} +2 -2
  124. data/spec/lib/metasploit/model/search/operation/{string/value_spec.rb → value/string_spec.rb} +2 -2
  125. data/spec/support/shared/examples/metasploit/model/search/operation/{integer/value.rb → value/integer.rb} +2 -2
  126. data/spec/support/shared/examples/metasploit/model/search/operation/{string/value.rb → value/string.rb} +2 -2
  127. metadata +16 -13
@@ -1,5 +1,6 @@
1
- require 'metasploit/model/module/instance'
2
-
3
1
  # Namespace for `Module`s that help with writing specs for {Metasploit::Model::Module::Instance}.
4
2
  module Metasploit::Model::Module::Instance::Spec
3
+ extend ActiveSupport::Autoload
4
+
5
+ autoload :Template
5
6
  end
@@ -1,168 +1,159 @@
1
- require 'metasploit/model/nilify_blanks'
2
- require 'metasploit/model/translation'
3
-
4
- module Metasploit
5
- module Model
6
- module Module
7
- # Concern for sharing common code between `Mdm::Module::Path` and `Metasploit::Framework::Module::Path`. Define
8
- # {#gem}, {#name}, and {#real_path} by following the abstract instructions for each attribute.
9
- module Path
10
- extend ActiveModel::Naming
11
- extend ActiveSupport::Concern
12
-
13
- include Metasploit::Model::NilifyBlanks
14
- include Metasploit::Model::Translation
15
-
16
- included do
17
- include ActiveModel::Dirty
18
- include ActiveModel::MassAssignmentSecurity
19
- include ActiveModel::Validations
20
- include ActiveModel::Validations::Callbacks
21
- include Metasploit::Model::RealPathname
22
-
23
- #
24
- # Callbacks
25
- #
26
-
27
- nilify_blank :gem,
28
- :name
29
- before_validation :normalize_real_path
30
-
31
- #
32
- # Mass Assignment Security
33
- #
34
-
35
- attr_accessible :gem
36
- attr_accessible :name
37
- attr_accessible :real_path
38
-
39
- #
40
- # Validations
41
- #
42
-
43
- validate :directory
44
- validate :gem_and_name
45
- end
46
-
47
- #
48
- # Attributes
49
- #
50
-
51
- # @!attribute [rw] gem
52
- # @abstract In an ActiveModel, this should be an `attr_accessor :gem`. In an ActiveRecord, this should be a
53
- # string gem column.
54
- #
55
- # The name of the gem that is adding this module path to metasploit-framework. For paths normally added by
56
- # metasploit-framework itself, this would be `'metasploit-framework'`, while for Metasploit Pro this would be
57
- # `'metasploit-pro'`. The name used for `gem` does not have to be a gem on rubygems, it just functions as a
58
- # namespace for {#name} so that projects using metasploit-framework do not need to worry about collisions on
59
- # {#name} which could disrupt the cache behavior.
60
- #
61
- # @return [String]
62
-
63
- # @!attribute [rw] name
64
- # @abstract In an ActiveModel, this should be an `attr_accessor :name`. In an ActiveRecord, this should be a
65
- # string name column.
66
- #
67
- # The name of the module path scoped to {#gem}. {#gem} and {#name} uniquely identify this path so that if
68
- # {#real_path} changes, the entire cache does not need to be invalidated because the change in {#real_path}
69
- # will still be tied to the same ({#gem}, {#name}) tuple.
70
- #
71
- # @return [String]
72
-
73
- # @!attribute [rw] real_path
74
- # @abstract In an ActiveModel, this should be an `attr_accesor :real_path`. In an ActiveRecord, this should
75
- # be a text real_path column.
76
- #
77
- # @note Non-real paths will be converted to real paths in a before validation callback, so take care to either
78
- # pass real paths or pay attention when setting {#real_path} and then changing directories before
79
- # validating.
80
- #
81
- # The real (absolute) path to module path.
82
- #
83
- # @return [String]
84
-
85
- #
86
- # Instance Methods
87
- #
88
-
89
- # Returns whether {#real_path} is a directory.
90
- #
91
- # @return [true] if {#real_path} is a directory.
92
- # @return [false] if {#real_path} is not a directory.
93
- def directory?
94
- directory = false
95
-
96
- if real_path and File.directory?(real_path)
97
- directory = true
98
- end
99
-
100
- directory
101
- end
102
-
103
- # Returns whether is a named path.
104
- #
105
- # @return [false] if gem is blank or name is blank.
106
- # @return [true] if gem is not blank and name is not blank.
107
- def named?
108
- named = false
109
-
110
- if gem.present? and name.present?
111
- named = true
112
- end
113
-
114
- named
115
- end
116
-
117
- # Returns whether was a named path. This is the equivalent of {#named?}, but checks the old, pre-change
118
- # values for {#gem} and {#name}.
119
- #
120
- # @return [false] is gem_was is blank or name_was is blank.
121
- # @return [true] if gem_was is not blank and name_was is not blank.
122
- def was_named?
123
- was_named = false
124
-
125
- if gem_was.present? and name_was.present?
126
- was_named = true
127
- end
128
-
129
- was_named
130
- end
131
-
132
- private
133
-
134
- # Validates that either {#directory?} is `true`.
135
- #
136
- # @return [void]
137
- def directory
138
- unless directory?
139
- errors[:real_path] << 'must be a directory'
140
- end
141
- end
142
-
143
- # Validates that either both {#gem} and {#name} are present or both are `nil`.
144
- #
145
- # @return [void]
146
- def gem_and_name
147
- if name.present? and gem.blank?
148
- errors[:gem] << "can't be blank if name is present"
149
- end
150
-
151
- if gem.present? and name.blank?
152
- errors[:name] << "can't be blank if gem is present"
153
- end
154
- end
155
-
156
- # If {#real_path} is set and exists on disk, then converts it to a real path to eliminate any symlinks.
157
- #
158
- # @return [void]
159
- # @see Metasploit::Model::File.realpath
160
- def normalize_real_path
161
- if real_path and File.exist?(real_path)
162
- self.real_path = Metasploit::Model::File.realpath(real_path)
163
- end
164
- end
165
- end
1
+ # Concern for sharing common code between `Mdm::Module::Path` and `Metasploit::Framework::Module::Path`. Define
2
+ # {#gem}, {#name}, and {#real_path} by following the abstract instructions for each attribute.
3
+ module Metasploit::Model::Module::Path
4
+ extend ActiveModel::Naming
5
+ extend ActiveSupport::Concern
6
+
7
+ include Metasploit::Model::NilifyBlanks
8
+ include Metasploit::Model::Translation
9
+
10
+ included do
11
+ include ActiveModel::Dirty
12
+ include ActiveModel::MassAssignmentSecurity
13
+ include ActiveModel::Validations
14
+ include ActiveModel::Validations::Callbacks
15
+ include Metasploit::Model::RealPathname
16
+
17
+ #
18
+ # Callbacks
19
+ #
20
+
21
+ nilify_blank :gem,
22
+ :name
23
+ before_validation :normalize_real_path
24
+
25
+ #
26
+ # Mass Assignment Security
27
+ #
28
+
29
+ attr_accessible :gem
30
+ attr_accessible :name
31
+ attr_accessible :real_path
32
+
33
+ #
34
+ # Validations
35
+ #
36
+
37
+ validate :directory
38
+ validate :gem_and_name
39
+ end
40
+
41
+ #
42
+ # Attributes
43
+ #
44
+
45
+ # @!attribute [rw] gem
46
+ # @abstract In an ActiveModel, this should be an `attr_accessor :gem`. In an ActiveRecord, this should be a
47
+ # string gem column.
48
+ #
49
+ # The name of the gem that is adding this module path to metasploit-framework. For paths normally added by
50
+ # metasploit-framework itself, this would be `'metasploit-framework'`, while for Metasploit Pro this would be
51
+ # `'metasploit-pro'`. The name used for `gem` does not have to be a gem on rubygems, it just functions as a
52
+ # namespace for {#name} so that projects using metasploit-framework do not need to worry about collisions on
53
+ # {#name} which could disrupt the cache behavior.
54
+ #
55
+ # @return [String]
56
+
57
+ # @!attribute [rw] name
58
+ # @abstract In an ActiveModel, this should be an `attr_accessor :name`. In an ActiveRecord, this should be a
59
+ # string name column.
60
+ #
61
+ # The name of the module path scoped to {#gem}. {#gem} and {#name} uniquely identify this path so that if
62
+ # {#real_path} changes, the entire cache does not need to be invalidated because the change in {#real_path}
63
+ # will still be tied to the same ({#gem}, {#name}) tuple.
64
+ #
65
+ # @return [String]
66
+
67
+ # @!attribute [rw] real_path
68
+ # @abstract In an ActiveModel, this should be an `attr_accesor :real_path`. In an ActiveRecord, this should
69
+ # be a text real_path column.
70
+ #
71
+ # @note Non-real paths will be converted to real paths in a before validation callback, so take care to either
72
+ # pass real paths or pay attention when setting {#real_path} and then changing directories before
73
+ # validating.
74
+ #
75
+ # The real (absolute) path to module path.
76
+ #
77
+ # @return [String]
78
+
79
+ #
80
+ # Instance Methods
81
+ #
82
+
83
+ # Returns whether {#real_path} is a directory.
84
+ #
85
+ # @return [true] if {#real_path} is a directory.
86
+ # @return [false] if {#real_path} is not a directory.
87
+ def directory?
88
+ directory = false
89
+
90
+ if real_path and File.directory?(real_path)
91
+ directory = true
92
+ end
93
+
94
+ directory
95
+ end
96
+
97
+ # Returns whether is a named path.
98
+ #
99
+ # @return [false] if gem is blank or name is blank.
100
+ # @return [true] if gem is not blank and name is not blank.
101
+ def named?
102
+ named = false
103
+
104
+ if gem.present? and name.present?
105
+ named = true
106
+ end
107
+
108
+ named
109
+ end
110
+
111
+ # Returns whether was a named path. This is the equivalent of {#named?}, but checks the old, pre-change
112
+ # values for {#gem} and {#name}.
113
+ #
114
+ # @return [false] is gem_was is blank or name_was is blank.
115
+ # @return [true] if gem_was is not blank and name_was is not blank.
116
+ def was_named?
117
+ was_named = false
118
+
119
+ if gem_was.present? and name_was.present?
120
+ was_named = true
121
+ end
122
+
123
+ was_named
124
+ end
125
+
126
+ private
127
+
128
+ # Validates that either {#directory?} is `true`.
129
+ #
130
+ # @return [void]
131
+ def directory
132
+ unless directory?
133
+ errors[:real_path] << 'must be a directory'
134
+ end
135
+ end
136
+
137
+ # Validates that either both {#gem} and {#name} are present or both are `nil`.
138
+ #
139
+ # @return [void]
140
+ def gem_and_name
141
+ if name.present? and gem.blank?
142
+ errors[:gem] << "can't be blank if name is present"
143
+ end
144
+
145
+ if gem.present? and name.blank?
146
+ errors[:name] << "can't be blank if gem is present"
147
+ end
148
+ end
149
+
150
+ # If {#real_path} is set and exists on disk, then converts it to a real path to eliminate any symlinks.
151
+ #
152
+ # @return [void]
153
+ # @see Metasploit::Model::File.realpath
154
+ def normalize_real_path
155
+ if real_path and File.exist?(real_path)
156
+ self.real_path = Metasploit::Model::File.realpath(real_path)
166
157
  end
167
158
  end
168
- end
159
+ end
@@ -1,40 +1,32 @@
1
- require 'metasploit/model/translation'
1
+ # Joins {Metasploit::Model::Module::Instance} and {Metasploit::Model::Platform.}
2
+ module Metasploit::Model::Module::Platform
3
+ extend ActiveModel::Naming
4
+ extend ActiveSupport::Concern
2
5
 
3
- module Metasploit
4
- module Model
5
- module Module
6
- # Joins {Metasploit::Model::Module::Instance} and {Metasploit::Model::Platform.}
7
- module Platform
8
- extend ActiveModel::Naming
9
- extend ActiveSupport::Concern
6
+ include Metasploit::Model::Translation
10
7
 
11
- include Metasploit::Model::Translation
8
+ included do
9
+ include ActiveModel::Validations
12
10
 
13
- included do
14
- include ActiveModel::Validations
11
+ #
12
+ # Validations
13
+ #
15
14
 
16
- #
17
- # Validations
18
- #
19
-
20
- validates :module_instance, :presence => true
21
- validates :platform, :presence => true
22
- end
15
+ validates :module_instance, :presence => true
16
+ validates :platform, :presence => true
17
+ end
23
18
 
24
- #
25
- # Associations
26
- #
19
+ #
20
+ # Associations
21
+ #
27
22
 
28
- # @!attribute [rw] module_instance
29
- # Module that supports {#platform}.
30
- #
31
- # @return [Metasploit::Model::Module::Instance]
23
+ # @!attribute [rw] module_instance
24
+ # Module that supports {#platform}.
25
+ #
26
+ # @return [Metasploit::Model::Module::Instance]
32
27
 
33
- # @!attribute [rw] platform
34
- # Platform supported by {#module_instance}.
35
- #
36
- # @return [Metasploit::Model::Platform]
37
- end
38
- end
39
- end
40
- end
28
+ # @!attribute [rw] platform
29
+ # Platform supported by {#module_instance}.
30
+ #
31
+ # @return [Metasploit::Model::Platform]
32
+ end
@@ -1,93 +1,85 @@
1
- require 'metasploit/model/translation'
1
+ # Code shared between `Mdm::Module::Rank` and `Metasploit::Framework::Module::Rank`.
2
+ module Metasploit::Model::Module::Rank
3
+ extend ActiveModel::Naming
4
+ extend ActiveSupport::Concern
2
5
 
3
- module Metasploit
4
- module Model
5
- module Module
6
- # Code shared between `Mdm::Module::Rank` and `Metasploit::Framework::Module::Rank`.
7
- module Rank
8
- extend ActiveModel::Naming
9
- extend ActiveSupport::Concern
6
+ include Metasploit::Model::Translation
10
7
 
11
- include Metasploit::Model::Translation
8
+ #
9
+ # CONSTANTS
10
+ #
12
11
 
13
- #
14
- # CONSTANTS
15
- #
12
+ # Regular expression to ensure that {#name} is a word starting with a capital letter
13
+ NAME_REGEXP = /\A[A-Z][a-z]+\Z/
16
14
 
17
- # Regular expression to ensure that {#name} is a word starting with a capital letter
18
- NAME_REGEXP = /\A[A-Z][a-z]+\Z/
15
+ # Converts {#name} to {#number}. Used for seeding. Seeds exist so that reports can use module_ranks to get the
16
+ # name of a rank without having to duplicate this constant.
17
+ NUMBER_BY_NAME = {
18
+ 'Manual' => 0,
19
+ 'Low' => 100,
20
+ 'Average' => 200,
21
+ 'Normal' => 300,
22
+ 'Good' => 400,
23
+ 'Great' => 500,
24
+ 'Excellent' => 600
25
+ }
26
+ # Converts {#number} to {#name}. Used to convert *Ranking constants used in `Msf::Modules` back to Strings.
27
+ NAME_BY_NUMBER = NUMBER_BY_NAME.invert
19
28
 
20
- # Converts {#name} to {#number}. Used for seeding. Seeds exist so that reports can use module_ranks to get the
21
- # name of a rank without having to duplicate this constant.
22
- NUMBER_BY_NAME = {
23
- 'Manual' => 0,
24
- 'Low' => 100,
25
- 'Average' => 200,
26
- 'Normal' => 300,
27
- 'Good' => 400,
28
- 'Great' => 500,
29
- 'Excellent' => 600
30
- }
31
- # Converts {#number} to {#name}. Used to convert *Ranking constants used in `Msf::Modules` back to Strings.
32
- NAME_BY_NUMBER = NUMBER_BY_NAME.invert
29
+ included do
30
+ include ActiveModel::MassAssignmentSecurity
31
+ include ActiveModel::Validations
32
+ include Metasploit::Model::Search
33
33
 
34
- included do
35
- include ActiveModel::MassAssignmentSecurity
36
- include ActiveModel::Validations
37
- include Metasploit::Model::Search
34
+ #
35
+ # Mass Assignment Security
36
+ #
38
37
 
39
- #
40
- # Mass Assignment Security
41
- #
38
+ attr_accessible :name
39
+ attr_accessible :number
42
40
 
43
- attr_accessible :name
44
- attr_accessible :number
41
+ #
42
+ # Search Attributes
43
+ #
45
44
 
46
- #
47
- # Search Attributes
48
- #
45
+ search_attribute :name, :type => :string
46
+ search_attribute :number, :type => :integer
49
47
 
50
- search_attribute :name, :type => :string
51
- search_attribute :number, :type => :integer
48
+ #
49
+ # Validations
50
+ #
52
51
 
53
- #
54
- # Validations
55
- #
56
-
57
- validates :name,
58
- # To ensure NUMBER_BY_NAME and seeds stay in sync.
59
- :inclusion => {
60
- :in => NUMBER_BY_NAME.keys
61
- },
62
- # To ensure new seeds follow pattern.
63
- :format => {
64
- :with => NAME_REGEXP
65
- }
66
- validates :number,
67
- # to ensure NUMBER_BY_NAME and seeds stay in sync.
68
- :inclusion => {
69
- :in => NUMBER_BY_NAME.values
70
- },
71
- # To ensure new seeds follow pattern.
72
- :numericality => {
73
- :only_integer => true
74
- }
75
- end
52
+ validates :name,
53
+ # To ensure NUMBER_BY_NAME and seeds stay in sync.
54
+ :inclusion => {
55
+ :in => NUMBER_BY_NAME.keys
56
+ },
57
+ # To ensure new seeds follow pattern.
58
+ :format => {
59
+ :with => NAME_REGEXP
60
+ }
61
+ validates :number,
62
+ # to ensure NUMBER_BY_NAME and seeds stay in sync.
63
+ :inclusion => {
64
+ :in => NUMBER_BY_NAME.values
65
+ },
66
+ # To ensure new seeds follow pattern.
67
+ :numericality => {
68
+ :only_integer => true
69
+ }
70
+ end
76
71
 
77
- #
78
- # Attributes
79
- #
72
+ #
73
+ # Attributes
74
+ #
80
75
 
81
- # @!attribute [rw] name
82
- # The name of the rank.
83
- #
84
- # @return [String]
76
+ # @!attribute [rw] name
77
+ # The name of the rank.
78
+ #
79
+ # @return [String]
85
80
 
86
- # @!attribute [rw] number
87
- # The numerical value of the rank. Higher numbers are better.
88
- #
89
- # @return [Integer]
90
- end
91
- end
92
- end
93
- end
81
+ # @!attribute [rw] number
82
+ # The numerical value of the rank. Higher numbers are better.
83
+ #
84
+ # @return [Integer]
85
+ end