metasploit-model 0.28.0-java → 0.29.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (206) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +3 -1
  3. data/config/locales/en.yml +0 -171
  4. data/lib/metasploit/model.rb +0 -2
  5. data/lib/metasploit/model/spec.rb +0 -130
  6. data/lib/metasploit/model/version.rb +1 -1
  7. data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +4 -6
  8. data/spec/support/shared/examples/metasploit/model/translation.rb +1 -1
  9. data/spec/support/shared/examples/search_association.rb +1 -1
  10. data/spec/support/shared/examples/search_with.rb +4 -2
  11. metadata +2 -348
  12. data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -125
  13. data/app/models/metasploit/model/module/class/spec/template.rb +0 -92
  14. data/app/models/metasploit/model/module/instance/spec/template.rb +0 -97
  15. data/app/models/metasploit/model/spec/template.rb +0 -277
  16. data/app/validators/derivation_validator.rb +0 -17
  17. data/app/validators/dynamic_length_validator.rb +0 -45
  18. data/lib/metasploit/model/architecture.rb +0 -342
  19. data/lib/metasploit/model/author.rb +0 -54
  20. data/lib/metasploit/model/authority.rb +0 -141
  21. data/lib/metasploit/model/authority/bid.rb +0 -10
  22. data/lib/metasploit/model/authority/cve.rb +0 -10
  23. data/lib/metasploit/model/authority/msb.rb +0 -10
  24. data/lib/metasploit/model/authority/osvdb.rb +0 -10
  25. data/lib/metasploit/model/authority/pmasa.rb +0 -10
  26. data/lib/metasploit/model/authority/secunia.rb +0 -10
  27. data/lib/metasploit/model/authority/us_cert_vu.rb +0 -10
  28. data/lib/metasploit/model/authority/waraxe.rb +0 -31
  29. data/lib/metasploit/model/authority/zdi.rb +0 -10
  30. data/lib/metasploit/model/derivation.rb +0 -109
  31. data/lib/metasploit/model/derivation/full_name.rb +0 -19
  32. data/lib/metasploit/model/email_address.rb +0 -124
  33. data/lib/metasploit/model/module.rb +0 -20
  34. data/lib/metasploit/model/module/action.rb +0 -52
  35. data/lib/metasploit/model/module/ancestor.rb +0 -491
  36. data/lib/metasploit/model/module/ancestor/spec.rb +0 -6
  37. data/lib/metasploit/model/module/architecture.rb +0 -34
  38. data/lib/metasploit/model/module/author.rb +0 -40
  39. data/lib/metasploit/model/module/class.rb +0 -403
  40. data/lib/metasploit/model/module/class/spec.rb +0 -6
  41. data/lib/metasploit/model/module/handler.rb +0 -29
  42. data/lib/metasploit/model/module/instance.rb +0 -622
  43. data/lib/metasploit/model/module/instance/spec.rb +0 -6
  44. data/lib/metasploit/model/module/path.rb +0 -159
  45. data/lib/metasploit/model/module/platform.rb +0 -32
  46. data/lib/metasploit/model/module/rank.rb +0 -85
  47. data/lib/metasploit/model/module/reference.rb +0 -32
  48. data/lib/metasploit/model/module/stance.rb +0 -16
  49. data/lib/metasploit/model/module/target.rb +0 -78
  50. data/lib/metasploit/model/module/target/architecture.rb +0 -34
  51. data/lib/metasploit/model/module/target/platform.rb +0 -34
  52. data/lib/metasploit/model/module/type.rb +0 -38
  53. data/lib/metasploit/model/platform.rb +0 -246
  54. data/lib/metasploit/model/real_pathname.rb +0 -16
  55. data/lib/metasploit/model/reference.rb +0 -104
  56. data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +0 -174
  57. data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +0 -222
  58. data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +0 -201
  59. data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +0 -62
  60. data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +0 -197
  61. data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +0 -135
  62. data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +0 -124
  63. data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +0 -387
  64. data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +0 -399
  65. data/spec/app/models/metasploit/model/spec/template_spec.rb +0 -23
  66. data/spec/app/validators/derivation_validator_spec.rb +0 -92
  67. data/spec/app/validators/dynamic_length_validator_spec.rb +0 -293
  68. data/spec/dummy/app/models/dummy/architecture.rb +0 -92
  69. data/spec/dummy/app/models/dummy/author.rb +0 -15
  70. data/spec/dummy/app/models/dummy/authority.rb +0 -130
  71. data/spec/dummy/app/models/dummy/email_address.rb +0 -27
  72. data/spec/dummy/app/models/dummy/module/action.rb +0 -25
  73. data/spec/dummy/app/models/dummy/module/ancestor.rb +0 -67
  74. data/spec/dummy/app/models/dummy/module/architecture.rb +0 -19
  75. data/spec/dummy/app/models/dummy/module/author.rb +0 -28
  76. data/spec/dummy/app/models/dummy/module/class.rb +0 -69
  77. data/spec/dummy/app/models/dummy/module/instance.rb +0 -209
  78. data/spec/dummy/app/models/dummy/module/path.rb +0 -64
  79. data/spec/dummy/app/models/dummy/module/platform.rb +0 -19
  80. data/spec/dummy/app/models/dummy/module/rank.rb +0 -44
  81. data/spec/dummy/app/models/dummy/module/reference.rb +0 -19
  82. data/spec/dummy/app/models/dummy/module/target.rb +0 -62
  83. data/spec/dummy/app/models/dummy/module/target/architecture.rb +0 -19
  84. data/spec/dummy/app/models/dummy/module/target/platform.rb +0 -19
  85. data/spec/dummy/app/models/dummy/platform.rb +0 -58
  86. data/spec/dummy/app/models/dummy/reference.rb +0 -31
  87. data/spec/dummy/spec/factories/dummy/architectures.rb +0 -13
  88. data/spec/dummy/spec/factories/dummy/authorities.rb +0 -32
  89. data/spec/dummy/spec/factories/dummy/authors.rb +0 -8
  90. data/spec/dummy/spec/factories/dummy/email_addresses.rb +0 -8
  91. data/spec/dummy/spec/factories/dummy/module/actions.rb +0 -13
  92. data/spec/dummy/spec/factories/dummy/module/ancestors.rb +0 -45
  93. data/spec/dummy/spec/factories/dummy/module/architectures.rb +0 -35
  94. data/spec/dummy/spec/factories/dummy/module/authors.rb +0 -10
  95. data/spec/dummy/spec/factories/dummy/module/classes.rb +0 -40
  96. data/spec/dummy/spec/factories/dummy/module/instances.rb +0 -86
  97. data/spec/dummy/spec/factories/dummy/module/paths.rb +0 -16
  98. data/spec/dummy/spec/factories/dummy/module/platforms.rb +0 -35
  99. data/spec/dummy/spec/factories/dummy/module/ranks.rb +0 -14
  100. data/spec/dummy/spec/factories/dummy/module/references.rb +0 -17
  101. data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +0 -40
  102. data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +0 -41
  103. data/spec/dummy/spec/factories/dummy/module/targets.rb +0 -46
  104. data/spec/dummy/spec/factories/dummy/platforms.rb +0 -3
  105. data/spec/dummy/spec/factories/dummy/references.rb +0 -26
  106. data/spec/factories/metasploit/model/architectures.rb +0 -6
  107. data/spec/factories/metasploit/model/authorities.rb +0 -28
  108. data/spec/factories/metasploit/model/authors.rb +0 -9
  109. data/spec/factories/metasploit/model/email_addresses.rb +0 -14
  110. data/spec/factories/metasploit/model/module/actions.rb +0 -9
  111. data/spec/factories/metasploit/model/module/ancestors.rb +0 -180
  112. data/spec/factories/metasploit/model/module/architectures.rb +0 -15
  113. data/spec/factories/metasploit/model/module/classes.rb +0 -47
  114. data/spec/factories/metasploit/model/module/handlers.rb +0 -3
  115. data/spec/factories/metasploit/model/module/instances.rb +0 -83
  116. data/spec/factories/metasploit/model/module/paths.rb +0 -51
  117. data/spec/factories/metasploit/model/module/platforms.rb +0 -15
  118. data/spec/factories/metasploit/model/module/ranks.rb +0 -9
  119. data/spec/factories/metasploit/model/module/references.rb +0 -11
  120. data/spec/factories/metasploit/model/module/stances.rb +0 -3
  121. data/spec/factories/metasploit/model/module/targets.rb +0 -22
  122. data/spec/factories/metasploit/model/module/types.rb +0 -5
  123. data/spec/factories/metasploit/model/references.rb +0 -88
  124. data/spec/lib/metasploit/model/architecture_spec.rb +0 -52
  125. data/spec/lib/metasploit/model/author_spec.rb +0 -6
  126. data/spec/lib/metasploit/model/authority/bid_spec.rb +0 -17
  127. data/spec/lib/metasploit/model/authority/cve_spec.rb +0 -17
  128. data/spec/lib/metasploit/model/authority/msb_spec.rb +0 -17
  129. data/spec/lib/metasploit/model/authority/osvdb_spec.rb +0 -17
  130. data/spec/lib/metasploit/model/authority/pmasa_spec.rb +0 -17
  131. data/spec/lib/metasploit/model/authority/secunia_spec.rb +0 -17
  132. data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +0 -17
  133. data/spec/lib/metasploit/model/authority/waraxe_spec.rb +0 -51
  134. data/spec/lib/metasploit/model/authority/zdi_spec.rb +0 -21
  135. data/spec/lib/metasploit/model/authority_spec.rb +0 -10
  136. data/spec/lib/metasploit/model/derivation/full_name_spec.rb +0 -75
  137. data/spec/lib/metasploit/model/derivation_spec.rb +0 -217
  138. data/spec/lib/metasploit/model/email_address_spec.rb +0 -19
  139. data/spec/lib/metasploit/model/module/action_spec.rb +0 -6
  140. data/spec/lib/metasploit/model/module/ancestor_spec.rb +0 -6
  141. data/spec/lib/metasploit/model/module/architecture_spec.rb +0 -9
  142. data/spec/lib/metasploit/model/module/author_spec.rb +0 -6
  143. data/spec/lib/metasploit/model/module/class_spec.rb +0 -19
  144. data/spec/lib/metasploit/model/module/handler_spec.rb +0 -61
  145. data/spec/lib/metasploit/model/module/instance_spec.rb +0 -183
  146. data/spec/lib/metasploit/model/module/path_spec.rb +0 -6
  147. data/spec/lib/metasploit/model/module/platform_spec.rb +0 -9
  148. data/spec/lib/metasploit/model/module/rank_spec.rb +0 -29
  149. data/spec/lib/metasploit/model/module/reference_spec.rb +0 -9
  150. data/spec/lib/metasploit/model/module/stance_spec.rb +0 -30
  151. data/spec/lib/metasploit/model/module/target/architecture_spec.rb +0 -9
  152. data/spec/lib/metasploit/model/module/target/platform_spec.rb +0 -9
  153. data/spec/lib/metasploit/model/module/target_spec.rb +0 -9
  154. data/spec/lib/metasploit/model/module/type_spec.rb +0 -125
  155. data/spec/lib/metasploit/model/platform_spec.rb +0 -100
  156. data/spec/lib/metasploit/model/reference_spec.rb +0 -21
  157. data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +0 -12
  158. data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +0 -10
  159. data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +0 -15
  160. data/spec/support/shared/examples/derives.rb +0 -115
  161. data/spec/support/shared/examples/metasploit/model/architecture.rb +0 -425
  162. data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +0 -25
  163. data/spec/support/shared/examples/metasploit/model/author.rb +0 -27
  164. data/spec/support/shared/examples/metasploit/model/authority.rb +0 -124
  165. data/spec/support/shared/examples/metasploit/model/authority/seed.rb +0 -49
  166. data/spec/support/shared/examples/metasploit/model/email_address.rb +0 -220
  167. data/spec/support/shared/examples/metasploit/model/module/action.rb +0 -26
  168. data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +0 -2004
  169. data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +0 -63
  170. data/spec/support/shared/examples/metasploit/model/module/architecture.rb +0 -36
  171. data/spec/support/shared/examples/metasploit/model/module/author.rb +0 -29
  172. data/spec/support/shared/examples/metasploit/model/module/class.rb +0 -1514
  173. data/spec/support/shared/examples/metasploit/model/module/handler.rb +0 -21
  174. data/spec/support/shared/examples/metasploit/model/module/instance.rb +0 -1384
  175. data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +0 -537
  176. data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +0 -22
  177. data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +0 -38
  178. data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +0 -131
  179. data/spec/support/shared/examples/metasploit/model/module/path.rb +0 -493
  180. data/spec/support/shared/examples/metasploit/model/module/platform.rb +0 -36
  181. data/spec/support/shared/examples/metasploit/model/module/rank.rb +0 -92
  182. data/spec/support/shared/examples/metasploit/model/module/reference.rb +0 -16
  183. data/spec/support/shared/examples/metasploit/model/module/target.rb +0 -29
  184. data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +0 -56
  185. data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +0 -56
  186. data/spec/support/shared/examples/metasploit/model/platform.rb +0 -213
  187. data/spec/support/shared/examples/metasploit/model/real_pathname.rb +0 -29
  188. data/spec/support/shared/examples/metasploit/model/reference.rb +0 -410
  189. data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +0 -44
  190. data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +0 -72
  191. data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +0 -9
  192. data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +0 -8
  193. data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +0 -6
  194. data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +0 -3
  195. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +0 -1
  196. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +0 -1
  197. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +0 -1
  198. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +0 -5
  199. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +0 -1
  200. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +0 -4
  201. data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +0 -1
  202. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +0 -20
  203. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +0 -1
  204. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
  205. data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +0 -1
  206. data/spec/support/templates/metasploit/model/module/classes/_methods.rb.erb +0 -9
@@ -1,17 +0,0 @@
1
- # Validator for {Metasploit::Model::Derivation::ClassMethods#derives}.
2
- class DerivationValidator < ActiveModel::EachValidator
3
- # Validates that `attribute`'s `value` equals derived_<attribute>'s value. If they are not equal then the error
4
- # message is `'must match its derivation'`.
5
- #
6
- # @param record [#errors, ActiveRecord::Base] ActiveModel or ActiveRecord
7
- # @param attribute [Symbol] name of derived attribute.
8
- # @param value [Object] value of `attribute` in `record`.
9
- # @return [void]
10
- def validate_each(record, attribute, value)
11
- derived_value = record.send("derived_#{attribute}")
12
-
13
- if value != derived_value
14
- record.errors[attribute] << 'must match its derivation'
15
- end
16
- end
17
- end
@@ -1,45 +0,0 @@
1
- # Validates that `value` of `attribute` on `record` is meets the
2
- # `record.dynamic_length_validation_options(attribute)`.
3
- #
4
- # Works similar to `LengthValidator`, but the minimum and maximum lengths are controlled dynamically by the `record` to
5
- # allow the validation to vary based on some other attribute in the record.
6
- class DynamicLengthValidator < ActiveModel::EachValidator
7
- # Validates that value's `#length` meets the minimum and maximum options in
8
- # `record.dynamic_length_validation_options(attribute)`.
9
- #
10
- # @param record [Object, #dynamic_length_validation_options] record that supports dynmaic length options on
11
- # `attribute`.
12
- # @param attribute [Symbol] name of an attribute on `record` with the given `value`.
13
- # @param value [Object, #length] value of `attribute`.
14
- # @return [void]
15
- def validate_each(record, attribute, value)
16
- # dynamic_options are not checked for validity the way options would be for LengthValidator because
17
- # dynamic_length_validation_options can be {} in some cases.
18
- dynamic_options = record.dynamic_length_validation_options(attribute)
19
- value_length = value.length
20
-
21
- ActiveModel::Validations::LengthValidator::CHECKS.each do |key, validity_check|
22
- check_value = dynamic_options[key]
23
-
24
- if check_value
25
- unless value_length.send(validity_check, check_value)
26
- errors_options = dynamic_options.except(*ActiveModel::Validations::LengthValidator::RESERVED_OPTIONS)
27
- errors_options[:count] = check_value
28
-
29
- message = errors_options[:message]
30
- message_key = ActiveModel::Validations::LengthValidator::MESSAGES[key]
31
-
32
- unless message
33
- default_message = dynamic_options[message_key]
34
-
35
- if default_message
36
- errors_options[:message] = default_message
37
- end
38
- end
39
-
40
- record.errors.add(attribute, message_key, errors_options)
41
- end
42
- end
43
- end
44
- end
45
- end
@@ -1,342 +0,0 @@
1
- # Code shared between `Mdm::Architecture` and `Metasploit::Framework::Architecture`.
2
- module Metasploit::Model::Architecture
3
- extend ActiveModel::Naming
4
- extend ActiveSupport::Concern
5
-
6
- include Metasploit::Model::Translation
7
-
8
- #
9
- # CONSTANTS
10
- #
11
-
12
- # Valid values for {#abbreviation}
13
- ABBREVIATIONS = [
14
- 'armbe',
15
- 'armle',
16
- 'cbea',
17
- 'cbea64',
18
- 'cmd',
19
- 'dalvik',
20
- 'firefox',
21
- 'java',
22
- 'mipsbe',
23
- 'mipsle',
24
- 'nodejs',
25
- 'php',
26
- 'ppc',
27
- 'ppc64',
28
- 'python',
29
- 'ruby',
30
- 'sparc',
31
- 'tty',
32
- 'x86',
33
- 'x86_64'
34
- ]
35
- # Valid values for {#bits}.
36
- BITS = [
37
- 32,
38
- 64
39
- ]
40
- # Valid values for {#endianness}.
41
- ENDIANNESSES = [
42
- 'big',
43
- 'little'
44
- ]
45
- # Valid values for {#family}.
46
- FAMILIES = [
47
- 'arm',
48
- 'cbea',
49
- 'javascript',
50
- 'mips',
51
- 'ppc',
52
- 'sparc',
53
- 'x86'
54
- ]
55
- # Attributes for seeds. Ensures that in-database seeds for `Mdm::Architecture` and in-memory seeds for
56
- # `Metasploit::Framework::Architecture` are the same.
57
- SEED_ATTRIBUTES = [
58
- {
59
- :abbreviation => 'armbe',
60
- :bits => 32,
61
- :endianness => 'big',
62
- :family => 'arm',
63
- :summary => 'Little-endian ARM'
64
- },
65
- {
66
- :abbreviation => 'armle',
67
- :bits => 32,
68
- :endianness => 'little',
69
- :family => 'arm',
70
- :summary => 'Big-endian ARM'
71
- },
72
- {
73
- :abbreviation => 'cbea',
74
- :bits => 32,
75
- :endianness => 'big',
76
- :family => 'cbea',
77
- :summary => '32-bit Cell Broadband Engine Architecture'
78
- },
79
- {
80
- :abbreviation => 'cbea64',
81
- :bits => 64,
82
- :endianness => 'big',
83
- :family => 'cbea',
84
- :summary => '64-bit Cell Broadband Engine Architecture'
85
- },
86
- {
87
- :abbreviation => 'cmd',
88
- :bits => nil,
89
- :endianness => nil,
90
- :family => nil,
91
- :summary => 'Command Injection'
92
- },
93
- {
94
- :abbreviation => 'dalvik',
95
- :bits => nil,
96
- :endianness => nil,
97
- :family => nil,
98
- :summary => 'Dalvik process virtual machine used in Google Android'
99
- },
100
- {
101
- abbreviation: 'firefox',
102
- bits: nil,
103
- endianness: nil,
104
- family: 'javascript',
105
- summary: "Firefox's privileged javascript API"
106
- },
107
- {
108
- :abbreviation => 'java',
109
- :bits => nil,
110
- :endianness => 'big',
111
- :family => nil,
112
- :summary => 'Java'
113
- },
114
- {
115
- :abbreviation => 'mipsbe',
116
- :bits => 32,
117
- :endianness => 'big',
118
- :family => 'mips',
119
- :summary => 'Big-endian MIPS'
120
- },
121
- {
122
- :abbreviation => 'mipsle',
123
- :bits => 32,
124
- :endianness => 'little',
125
- :family => 'mips',
126
- :summary => 'Little-endian MIPS'
127
- },
128
- {
129
- abbreviation: 'nodejs',
130
- bits: nil,
131
- endianness: nil,
132
- family: 'javascript',
133
- summary: 'NodeJS'
134
- },
135
- {
136
- :abbreviation => 'php',
137
- :bits => nil,
138
- :endianness => nil,
139
- :family => nil,
140
- :summary => 'PHP'
141
- },
142
- {
143
- :abbreviation => 'ppc',
144
- :bits => 32,
145
- :endianness => 'big',
146
- :family => 'ppc',
147
- :summary => '32-bit Peformance Optimization With Enhanced RISC - Performance Computing'
148
- },
149
- {
150
- :abbreviation => 'ppc64',
151
- :bits => 64,
152
- :endianness => 'big',
153
- :family => 'ppc',
154
- :summary => '64-bit Performance Optimization With Enhanced RISC - Performance Computing'
155
- },
156
- {
157
- :abbreviation => 'python',
158
- :bits => nil,
159
- :endianness => nil,
160
- :family => nil,
161
- :summary => 'Python'
162
- },
163
- {
164
- :abbreviation => 'ruby',
165
- :bits => nil,
166
- :endianness => nil,
167
- :family => nil,
168
- :summary => 'Ruby'
169
- },
170
- {
171
- :abbreviation => 'sparc',
172
- :bits => nil,
173
- :endianness => nil,
174
- :family => 'sparc',
175
- :summary => 'Scalable Processor ARChitecture'
176
- },
177
- {
178
- :abbreviation => 'tty',
179
- :bits => nil,
180
- :endianness => nil,
181
- :family => nil,
182
- :summary => '*nix terminal'
183
- },
184
- {
185
- :abbreviation => 'x86',
186
- :bits => 32,
187
- :endianness => 'little',
188
- :family => 'x86',
189
- :summary => '32-bit x86'
190
- },
191
- {
192
- :abbreviation => 'x86_64',
193
- :bits => 64,
194
- :endianness => 'little',
195
- :family => 'x86',
196
- :summary => '64-bit x86'
197
- }
198
- ]
199
-
200
- included do
201
- include ActiveModel::Validations
202
- include Metasploit::Model::Search
203
-
204
- #
205
- # Search Attributes
206
- #
207
-
208
- search_attribute :abbreviation,
209
- type: {
210
- set: :string
211
- }
212
- search_attribute :bits,
213
- type: {
214
- set: :integer
215
- }
216
- search_attribute :endianness,
217
- type: {
218
- set: :string
219
- }
220
- search_attribute :family,
221
- type: {
222
- set: :string
223
- }
224
-
225
- #
226
- # Validations
227
- #
228
-
229
- validates :abbreviation,
230
- :inclusion => {
231
- :in => ABBREVIATIONS
232
- }
233
- validates :bits,
234
- :inclusion => {
235
- :allow_nil => true,
236
- :in => BITS
237
- }
238
- validates :endianness,
239
- :inclusion => {
240
- :allow_nil => true,
241
- :in => ENDIANNESSES
242
- }
243
- validates :family,
244
- :inclusion => {
245
- :allow_nil => true,
246
- :in => FAMILIES
247
- }
248
- validates :summary,
249
- :presence => true
250
- end
251
-
252
- # Adds <attribute>_set methods to class.
253
- module ClassMethods
254
- # Set of valid values to search for `attribute`. Does not include `nil` as search syntax cannot differentiate
255
- # '' and nil when parsing.
256
- #
257
- # @param attribute [Symbol] attribute name.
258
- # @return [Set]
259
- def self.set(attribute)
260
- SEED_ATTRIBUTES.each_with_object(Set.new) { |attributes, set|
261
- value = attributes.fetch(attribute)
262
-
263
- unless value.nil?
264
- set.add value
265
- end
266
- }
267
- end
268
-
269
- # @!method abbreviation_set
270
- # Set of valid {Metasploit::Model::Architecture#abbreviation} for search.
271
- #
272
- # @return [Set<String>]
273
- #
274
- # @!method bits_set
275
- # Set of valid {Metasploit::Model::Architecture#bits} for search.
276
- #
277
- # @return [Set<Integer>]
278
- #
279
- # @!method endianness_set
280
- # Set of valid {Metasploit::Model::Architecture#endianness} for search.
281
- #
282
- # @return [Set<String>]
283
- #
284
- # @!method family_set
285
- # Set of valid {Metasploit::Model::Architecture#family} for search.
286
- #
287
- # @return [Set<String>]
288
- [:abbreviation, :bits, :endianness, :family].each do |attribute|
289
- # calculate external to method so it is only calculated once
290
- set = self.set(attribute)
291
-
292
- define_method("#{attribute}_set") do
293
- set
294
- end
295
- end
296
- end
297
-
298
- #
299
- # Associations
300
- #
301
-
302
- # @!attribute [r] module_instances
303
- # {Metasploit::Model::Module::Instance Modules} that have this {Metasploit::Model::Module::Architecture} as a
304
- # {Metasploit::Model::Module::Instance#architectures support architecture}.
305
- #
306
- # @return [Array<Metasploit::Model::Module::Instance>]
307
-
308
- #
309
- # Attributes
310
- #
311
-
312
- # @!attribute [rw] abbreviation
313
- # Abbreviation used for the architecture. Will match ARCH constants in metasploit-framework.
314
- #
315
- # @return [String]
316
-
317
- # @!attribute [rw] bits
318
- # Number of bits supported by this architecture.
319
- #
320
- # @return [32] if 32-bit
321
- # @return [64] if 64-bit
322
- # @return [nil] if bits aren't applicable, such as for non-CPU architectures like ruby, etc.
323
-
324
- # @!attribute [rw] endianness
325
- # The endianness of the architecture.
326
- #
327
- # @return ['big'] if big endian
328
- # @return ['little'] if little endian
329
- # @return [nil] if endianness is not applicable, such as for software architectures like tty.
330
-
331
- # @!attribute [rw] family
332
- # The CPU architecture family.
333
- #
334
- # @return [String] if a CPU architecture.
335
- # @return [nil] if not a CPU architecture.
336
-
337
- # @!attribute [rw] summary
338
- # Sentence length summary of architecture. Usually an expansion of the abbreviation or initialism in the
339
- # {#abbreviation} and the {#bits} and {#endianness} in prose.
340
- #
341
- # @return [String]
342
- end
@@ -1,54 +0,0 @@
1
- # Code shared between `Mdm::Author` and `Metasploit::Framework::Author`.
2
- module Metasploit::Model::Author
3
- extend ActiveModel::Naming
4
- extend ActiveSupport::Concern
5
-
6
- include Metasploit::Model::Translation
7
-
8
- included do
9
- include ActiveModel::MassAssignmentSecurity
10
- include ActiveModel::Validations
11
- include Metasploit::Model::Search
12
-
13
- #
14
- # Mass Assignment Security
15
- #
16
-
17
- attr_accessible :name
18
-
19
- #
20
- # Search Attributes
21
- #
22
-
23
- search_attribute :name, :type => :string
24
-
25
- #
26
- # Validations
27
- #
28
-
29
- validates :name, :presence => true
30
- end
31
-
32
- #
33
- # Associations
34
- #
35
-
36
- # @!attribute [r] email_addresses
37
- # Email addresses used by this author across all {#module_instances}.
38
- #
39
- # @return [Array<Metasploit::Model::EmailAddress>]
40
-
41
- # @!attribute [r] module_instances
42
- # Modules written by this author.
43
- #
44
- # @return [Array<Metasploit::Model::Module::Instance>]
45
-
46
- #
47
- # Attributes
48
- #
49
-
50
- # @!attribute [rw] name
51
- # Full name (First + Last name) or handle of author.
52
- #
53
- # @return [String]
54
- end