metasploit-model 0.28.0 → 0.29.0

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 +8 -8
  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 +3 -349
  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,64 +0,0 @@
1
- # In-memory implementation of {Metasploit::Model::Module::Path} to allow testing of {Metasploit::Model::Module::Path} in
2
- # an ActiveModel and use of factories.
3
- class Dummy::Module::Path < Metasploit::Model::Base
4
- include Metasploit::Model::Module::Path
5
-
6
- #
7
- # Attributes Methods - used to track changed attributes
8
- #
9
-
10
- define_attribute_method :gem
11
- define_attribute_method :name
12
-
13
- #
14
- # Attributes
15
- #
16
-
17
- # @!attribute [rw] gem
18
- # The gem that owns this path.
19
- #
20
- # @return [String, nil]
21
- attr_accessor :gem
22
-
23
- # @!attribute [rw] name
24
- # The name of this path, scoped to {#gem}.
25
- #
26
- # @return [String, nil]
27
- attr_accessor :name
28
-
29
- # @!attribute [rw] real_path
30
- # Real (absolute) path on-disk.
31
- #
32
- # @return [String]
33
- attr_accessor :real_path
34
-
35
- #
36
- # Methods
37
- #
38
-
39
- # Updates {#gem} value and marks {#gem} as changed if `gem` differs from
40
- # {#gem}.
41
- #
42
- # @param gem [String, nil] (see #gem)
43
- # @return [String, nil] `gem`
44
- def gem=(gem)
45
- unless gem == @gem
46
- gem_will_change!
47
- end
48
-
49
- @gem = gem
50
- end
51
-
52
- # Updates {#name} value and marks {#name} as changed if `name` differs
53
- # from {#name}.
54
- #
55
- # @param name [String, nil] (see #name)
56
- # @return [String, nil] `name`
57
- def name=(name)
58
- unless name == @name
59
- name_will_change!
60
- end
61
-
62
- @name = name
63
- end
64
- end
@@ -1,19 +0,0 @@
1
- class Dummy::Module::Platform < Metasploit::Model::Base
2
- include Metasploit::Model::Module::Platform
3
-
4
- #
5
- # Associations
6
- #
7
-
8
- # @!attribute [rw] module_instance
9
- # Module that supports {#platform}.
10
- #
11
- # @return [Dummy::Module::Instance]
12
- attr_accessor :module_instance
13
-
14
- # @!attribute [rw] platform
15
- # Platform supported by {#module_instance}.
16
- #
17
- # @return [Dummy::Platform]
18
- attr_accessor :platform
19
- end
@@ -1,44 +0,0 @@
1
- # Implementation of {Metasploit::Model::Module::Rank} to allow testing of {Metasploit::Model::Module::Rank}
2
- # using an in-memory ActiveModel and use of factories.
3
- class Dummy::Module::Rank < Metasploit::Model::Base
4
- include Metasploit::Model::Module::Rank
5
-
6
- #
7
- # Attributes
8
- #
9
-
10
- # @!attribute [rw] name
11
- # The name of the rank.
12
- #
13
- # @return [String]
14
- attr_accessor :name
15
-
16
- # @!attribute [rw] number
17
- # The numerical value of the rank. Higher numbers are better.
18
- #
19
- # @return [Integer]
20
- attr_accessor :number
21
-
22
- # Keep single instance for each pair in {Metasploit::Model::Module::Rank::NUMBER_BY_NAME} to emulate unique database
23
- # seeds in-memory.
24
- #
25
- # @param name [String] {#name}
26
- # @return [Dummy::Module::Rank]
27
- def self.with_name(name)
28
- unless instance_variable_defined? :@instance_by_name
29
- @instance_by_name = {}
30
-
31
- NUMBER_BY_NAME.each do |instance_name, number|
32
- instance = new(:name => instance_name, :number => number)
33
-
34
- unless instance.valid?
35
- raise Metasploit::Model::Invalid.new(instance)
36
- end
37
-
38
- @instance_by_name[instance_name] = instance
39
- end
40
- end
41
-
42
- @instance_by_name.fetch(name)
43
- end
44
- end
@@ -1,19 +0,0 @@
1
- class Dummy::Module::Reference < Metasploit::Model::Base
2
- include Metasploit::Model::Module::Reference
3
-
4
- #
5
- # Associations
6
- #
7
-
8
- # @!attribute [rw] module_instance
9
- # {Dummy::Module::Instance Module} with {#reference}.
10
- #
11
- # @return [Dummy::Module::Instance]
12
- attr_accessor :module_instance
13
-
14
- # @!attribute [rw] reference
15
- # {Dummy::Reference reference} to exploit or proof-of-concept (PoC) code for {#module_instance}.
16
- #
17
- # @return [Dummy::Reference]
18
- attr_accessor :reference
19
- end
@@ -1,62 +0,0 @@
1
- # Implementation of {Metasploit::Model::Module::Target} to allow testing of {Metasploit::Model::Module::Target}
2
- # using an in-memory ActiveModel and use of factories.
3
- class Dummy::Module::Target < Metasploit::Model::Base
4
- include Metasploit::Model::Module::Target
5
-
6
- #
7
- # Associations
8
- #
9
-
10
-
11
- # @!attribute [r] architectures
12
- # Architectures that this target supports, either by being declared specifically for this target or because
13
- # this target did not override architectures and so inheritted the architecture set from the class.
14
- #
15
- # @return [Array<Metasploit::Model::Architecture>]
16
- def architectures
17
- target_architectures.map(&:architecture)
18
- end
19
-
20
- # @!attribute [rw] module_instance
21
- # Module where this target was declared.
22
- #
23
- # @return [Dummy::Module::Instance]
24
- attr_accessor :module_instance
25
-
26
- # @!attribute [r] platforms
27
- # Platforms that this target supports, either by being declared specifically for this target or because this
28
- # target did not override platforms and so inheritted the platform set from the class.
29
- #
30
- # @return [Array<Metasploit::Model::Platform>]
31
- def platforms
32
- target_platforms.map(&:platform)
33
- end
34
-
35
- # @!attribute [rw] target_architectures
36
- # Joins this target to its {#architectures}
37
- #
38
- # @return [Array<Metasploit::Model::Module::Target::Architecture]
39
- def target_architectures
40
- @target_architectures ||= []
41
- end
42
- attr_writer :target_architectures
43
-
44
- # @!attribute [rw] target_platforms
45
- # Joins this target to its {#platforms}
46
- #
47
- # @return [Array<Metasploit::Model::Module::Target::Platform>]
48
- def target_platforms
49
- @target_platforms ||= []
50
- end
51
- attr_writer :target_platforms
52
-
53
- #
54
- # Attributes
55
- #
56
-
57
- # @!attribute [rw] name
58
- # The name of this target.
59
- #
60
- # @return [String]
61
- attr_accessor :name
62
- end
@@ -1,19 +0,0 @@
1
- class Dummy::Module::Target::Architecture < Metasploit::Model::Base
2
- include Metasploit::Model::Module::Target::Architecture
3
-
4
- #
5
- # Associations
6
- #
7
-
8
- # @!attribute [rw] architecture
9
- # The architecture supported by the {#module_target}.
10
- #
11
- # @return [Dummy::Architecture]
12
- attr_accessor :architecture
13
-
14
- # @!attribute [rw] module_target
15
- # The module target that supports {#architecture}.
16
- #
17
- # @return [Dummy::Module::Target]
18
- attr_accessor :module_target
19
- end
@@ -1,19 +0,0 @@
1
- class Dummy::Module::Target::Platform < Metasploit::Model::Base
2
- include Metasploit::Model::Module::Target::Platform
3
-
4
- #
5
- # Associations
6
- #
7
-
8
- # @!attribute [rw] module_target
9
- # The module target that supports {#platform}.
10
- #
11
- # @return [Dummy::Module::Target]
12
- attr_accessor :module_target
13
-
14
- # @!attribute [rw] platform
15
- # The platform supported by the {#module_target}.
16
- #
17
- # @return [Dummy::Platform]
18
- attr_accessor :platform
19
- end
@@ -1,58 +0,0 @@
1
- # Implementation of {Metasploit::Model::Platform} to allow testing of {Metasploit::Model::Platform} using an in-memory
2
- # ActiveModel and use of factories.
3
- class Dummy::Platform < Metasploit::Model::Base
4
- include Metasploit::Model::Platform
5
-
6
- #
7
- # Attributes
8
- #
9
-
10
- # @!attribute [rw] fully_qualified_name
11
- # The fully qualified name of this platform, as would be used in the platform list in a metasploit-framework
12
- # module.
13
- #
14
- # @return [String]
15
- attr_accessor :fully_qualified_name
16
-
17
- # @!attribute [rw] parent
18
- # The parent platform of this platform. For example, Windows is parent of Windows 98, which is the parent of
19
- # Windows 98 FE.
20
- #
21
- # @return [nil] if this is a top-level platform, such as Windows or Linux.
22
- # @return [Metasploit::Model::Platform]
23
- attr_accessor :parent
24
-
25
- # @!attribute [rw] relative_name
26
- # The name of this platform relative to the {#fully_qualified_name} of {#parent}.
27
- #
28
- # @return [String]
29
- attr_accessor :relative_name
30
-
31
- #
32
- # Methods
33
- #
34
-
35
- def self.all
36
- # cache so that Dummy::Platform can be compared by identity
37
- unless instance_variable_defined? :@all
38
- @all = []
39
-
40
- Metasploit::Model::Platform.each_seed_attributes do |attributes|
41
- child = new(attributes)
42
- # validate to populate {#fully_qualified_name}
43
- child.valid!
44
-
45
- @all << child
46
-
47
- # yieldreturn
48
- child
49
- end
50
-
51
- # freeze objects to prevent specs from modifying them and interfering with other specs.
52
- @all.map(&:freeze)
53
- end
54
-
55
- @all
56
- end
57
- end
58
-
@@ -1,31 +0,0 @@
1
- # Implementation of {Metasploit::Model::Reference} to allow testing of {Metasploit::Model::Reference} using an in-memory
2
- # ActiveModel and use of factories.
3
- class Dummy::Reference < Metasploit::Model::Base
4
- include Metasploit::Model::Reference
5
-
6
- #
7
- # Associations
8
- #
9
-
10
- # @!attribute [rw] authority
11
- # The {Metasploit::Model::Authority authority} that assigned {#designation}.
12
- #
13
- # @return [Metasploit::Model::Authority, nil]
14
- attr_accessor :authority
15
-
16
- #
17
- # Attributes
18
- #
19
-
20
- # @!attribute [rw] designation
21
- # A designation (usually a string of numbers and dashes) assigned by {#authority}.
22
- #
23
- # @return [String, nil]
24
- attr_accessor :designation
25
-
26
- # @!attribute [rw] url
27
- # URL to web page with information about referenced exploit.
28
- #
29
- # @return [String, nil]
30
- attr_accessor :url
31
- end
@@ -1,13 +0,0 @@
1
- FactoryGirl.define do
2
- abbreviations = Metasploit::Model::Architecture::ABBREVIATIONS
3
-
4
- # dummy_architectures is not a factory, but a sequence because only the seeded Dummy::Architectures are valid
5
- sequence :dummy_architecture do |n|
6
- # use abbreviations since they are unique
7
- abbreviation = abbreviations[n % abbreviations.length]
8
-
9
- architecture = Dummy::Architecture.with_abbreviation(abbreviation)
10
-
11
- architecture
12
- end
13
- end
@@ -1,32 +0,0 @@
1
- FactoryGirl.define do
2
- factory :dummy_authority,
3
- :class => Dummy::Authority,
4
- :traits => [
5
- :metasploit_model_base,
6
- :metasploit_model_authority
7
- ] do
8
- factory :full_dummy_authority,
9
- :traits => [
10
- :full_metasploit_model_authority
11
- ]
12
-
13
- factory :obsolete_dummy_authority,
14
- :traits => [
15
- :obsolete_metasploit_model_authority
16
- ]
17
- end
18
-
19
- seed_abbreviations = Dummy::Authority::SEED_ATTRIBUTES.collect { |attributes|
20
- attributes[:abbreviation]
21
- }
22
-
23
- seed_abbreviation_count = seed_abbreviations.length
24
-
25
- sequence :seeded_dummy_authority do |n|
26
- seed_abbreviation = seed_abbreviations[n % seed_abbreviation_count]
27
-
28
- authority = Dummy::Authority.with_abbreviation(seed_abbreviation)
29
-
30
- authority
31
- end
32
- end
@@ -1,8 +0,0 @@
1
- FactoryGirl.define do
2
- factory :dummy_author,
3
- :class => Dummy::Author,
4
- :traits => [
5
- :metasploit_model_base,
6
- :metasploit_model_author
7
- ]
8
- end
@@ -1,8 +0,0 @@
1
- FactoryGirl.define do
2
- factory :dummy_email_address,
3
- :class => Dummy::EmailAddress,
4
- :traits => [
5
- :metasploit_model_base,
6
- :metasploit_model_email_address
7
- ]
8
- end
@@ -1,13 +0,0 @@
1
- FactoryGirl.define do
2
- factory :dummy_module_action,
3
- :class => Dummy::Module::Action,
4
- :traits => [
5
- :metasploit_model_module_action
6
- ] do
7
- #
8
- # Associations
9
- #
10
-
11
- association :module_instance, :factory => :dummy_module_instance
12
- end
13
- end
@@ -1,45 +0,0 @@
1
- FactoryGirl.define do
2
- # Used to test {Metasploit::Model::Module::Ancestor} and to ensure that traits work when used in factories.
3
- factory :dummy_module_ancestor,
4
- :class => Dummy::Module::Ancestor,
5
- :traits => [
6
- :metasploit_model_base,
7
- :metasploit_model_module_ancestor
8
- ] do
9
- #
10
- # Associations
11
- #
12
-
13
- # Dummy::Module::Path does not support save!, so need to make sure strategy is build, which will just use new
14
- association :parent_path, :factory => :dummy_module_path, :strategy => :build
15
-
16
- #
17
- # Child Factories
18
- #
19
-
20
- factory :non_payload_dummy_module_ancestor,
21
- :traits => [
22
- :non_payload_metasploit_model_module_ancestor
23
- ]
24
-
25
- factory :payload_dummy_module_ancestor,
26
- :traits => [
27
- :payload_metasploit_model_module_ancestor
28
- ] do
29
- factory :single_payload_dummy_module_ancestor,
30
- :traits => [
31
- :single_payload_metasploit_model_module_ancestor
32
- ]
33
-
34
- factory :stage_payload_dummy_module_ancestor,
35
- :traits => [
36
- :stage_payload_metasploit_model_module_ancestor
37
- ]
38
-
39
- factory :stager_payload_dummy_module_ancestor,
40
- :traits => [
41
- :stager_payload_metasploit_model_module_ancestor
42
- ]
43
- end
44
- end
45
- end