metasploit-model 0.28.0-java → 0.29.0-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 (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,217 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Derivation do
4
- let(:base_class) do
5
- # capture for class_eval scope
6
- described_class = self.described_class
7
-
8
- Class.new do
9
- extend ActiveModel::Callbacks
10
- include ActiveModel::Validations
11
- include ActiveModel::Validations::Callbacks
12
-
13
- include described_class
14
- end
15
- end
16
-
17
- context 'included' do
18
- let(:base_class) do
19
- Class.new do
20
- extend ActiveModel::Callbacks
21
- include ActiveModel::Validations
22
- include ActiveModel::Validations::Callbacks
23
- end
24
- end
25
-
26
- it 'should register #derive as a before validation callback' do
27
- base_class.should_receive(:before_validation).with(:derive)
28
-
29
- # capture for class_eval scope
30
- described_class = self.described_class
31
-
32
- base_class.class_eval do
33
- include described_class
34
- end
35
- end
36
- end
37
-
38
- context '#derive' do
39
- subject(:derive) do
40
- base_instance.send(:derive)
41
- end
42
-
43
- let(:attributes) do
44
- [
45
- :derivation,
46
- :formula
47
- ]
48
- end
49
-
50
- let(:base_instance) do
51
- base_class.new
52
- end
53
-
54
- let(:derivation) do
55
- 'derivation'
56
- end
57
-
58
- let(:formula) do
59
- nil
60
- end
61
-
62
- before(:each) do
63
- # capture for class_eval scope
64
- attributes = self.attributes
65
-
66
- base_class.class_eval do
67
- #
68
- # Attributes
69
- #
70
-
71
- # @!attribute [rw] derivation
72
- # @return [String]
73
- attr_accessor :derivation
74
-
75
- # @!attribute [rw] formula
76
- # @return [String]
77
- attr_accessor :formula
78
-
79
- #
80
- # Derivations
81
- #
82
-
83
- derives :derivation
84
- derives :formula
85
-
86
- #
87
- # Methods
88
- #
89
-
90
- # Derives #derivation.
91
- #
92
- # @return [String]
93
- def derived_derivation
94
- 'derived_derivation'
95
- end
96
-
97
- # Derives #formula.
98
- #
99
- # @return [String]
100
- def derived_formula
101
- 'derived_formula'
102
- end
103
- end
104
-
105
- base_instance.derivation = derivation
106
- base_instance.formula = formula
107
- end
108
-
109
- it 'should test value with nil?' do
110
- derivation.should_receive(:nil?).and_return(false)
111
-
112
- derive
113
- end
114
-
115
- context 'with nil value' do
116
- it 'should set attribute to derived_<attribute>' do
117
- derive
118
-
119
- base_instance.formula.should == base_instance.derived_formula
120
- end
121
- end
122
-
123
- context 'without nil value' do
124
- it 'should not set attribute to derived_<attribute>' do
125
- derive
126
-
127
- base_instance.derivation.should_not == base_instance.derived_derivation
128
- end
129
- end
130
- end
131
-
132
- context 'derives' do
133
- let(:attribute) do
134
- :derivative
135
- end
136
-
137
- context 'with :validate' do
138
- subject(:derives) do
139
- base_class.derives attribute, :validate => validate
140
- end
141
-
142
- context 'false' do
143
- let(:validate) do
144
- false
145
- end
146
-
147
- it 'should record :validate in validate_by_derived_attribute' do
148
- derives
149
-
150
- base_class.validate_by_derived_attribute[attribute].should == validate
151
- end
152
-
153
- it 'should not add derivation validation on attribute' do
154
- base_class.should_not_receive(:validates).with(
155
- attribute,
156
- hash_including(
157
- :derivation => true
158
- )
159
- )
160
-
161
- derives
162
- end
163
- end
164
-
165
- context 'true' do
166
- let(:validate) do
167
- true
168
- end
169
-
170
- it 'should record :validate in validate_by_derived_attribute' do
171
- derives
172
-
173
- base_class.validate_by_derived_attribute[attribute].should == validate
174
- end
175
-
176
- it 'should not add derivation validation on attribute' do
177
- base_class.should_receive(:validates).with(
178
- attribute,
179
- hash_including(
180
- :derivation => true
181
- )
182
- )
183
-
184
- derives
185
- end
186
- end
187
- end
188
-
189
- context 'without :validate' do
190
- subject(:derives) do
191
- base_class.derives attribute
192
- end
193
-
194
- it 'should default to false' do
195
- derives
196
-
197
- base_class.validate_by_derived_attribute[attribute].should be_false
198
- end
199
-
200
- it 'should not call validates' do
201
- base_class.should_not_receive(:validates)
202
-
203
- derives
204
- end
205
- end
206
- end
207
-
208
- context 'validate_by_derived_attribute' do
209
- subject(:validate_by_derived_attribute) do
210
- base_class.validate_by_derived_attribute
211
- end
212
-
213
- it 'should default to {}' do
214
- validate_by_derived_attribute.should == {}
215
- end
216
- end
217
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::EmailAddress,
4
- # setting the metadata type makes rspec-rails include RSpec::Rails::ModelExampleGroup, which includes a better
5
- # be_valid matcher that will print full error messages
6
- type: :model do
7
- it_should_behave_like 'Metasploit::Model::EmailAddress',
8
- namespace_name: 'Dummy' do
9
- def attribute_type(attribute)
10
- type_by_attribute = {
11
- domain: :string,
12
- full: :string,
13
- local: :string
14
- }
15
-
16
- type_by_attribute.fetch(attribute)
17
- end
18
- end
19
- end
@@ -1,6 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Action do
4
- it_should_behave_like 'Metasploit::Model::Module::Action',
5
- namespace_name: 'Dummy'
6
- end
@@ -1,6 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Ancestor do
4
- it_should_behave_like 'Metasploit::Model::Module::Ancestor',
5
- namespace_name: 'Dummy'
6
- end
@@ -1,9 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Architecture,
4
- # setting the metadata type makes rspec-rails include RSpec::Rails::ModelExampleGroup, which includes a better
5
- # be_valid matcher that will print full error messages
6
- type: :model do
7
- it_should_behave_like 'Metasploit::Model::Module::Architecture',
8
- namespace_name: 'Dummy'
9
- end
@@ -1,6 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Author do
4
- it_should_behave_like 'Metasploit::Model::Module::Author',
5
- namespace_name: 'Dummy'
6
- end
@@ -1,19 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Class do
4
- it_should_behave_like 'Metasploit::Model::Module::Class',
5
- namespace_name: 'Dummy' do
6
- def attribute_type(attribute)
7
- type_by_attribute = {
8
- :full_name => :text,
9
- :module_type => :string,
10
- :payload_type => :string,
11
- :reference_name => :text
12
- }
13
-
14
- type = type_by_attribute.fetch(attribute)
15
-
16
- type
17
- end
18
- end
19
- end
@@ -1,61 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Handler do
4
- context 'CONSTANTS' do
5
- context 'GENERAL_TYPES' do
6
- subject(:general_types) do
7
- described_class::GENERAL_TYPES
8
- end
9
-
10
- it { should include 'bind' }
11
- it { should include 'find' }
12
- it { should include 'none' }
13
- it { should include 'reverse' }
14
- it { should include 'tunnel' }
15
- end
16
-
17
- context 'GENERAL_TYPE_BY_TYPE' do
18
- subject(:general_type_by_type) do
19
- described_class::GENERAL_TYPE_BY_TYPE
20
- end
21
-
22
- its(['bind_tcp']) { should == 'bind' }
23
- its(['find_port']) { should == 'find' }
24
- its(['find_shell']) { should == 'find' }
25
- its(['find_tag']) { should == 'find' }
26
- its(['none']) { should == 'none' }
27
- its(['reverse_http']) { should == 'tunnel' }
28
- its(['reverse_https']) { should == 'tunnel' }
29
- its(['reverse_https_proxy']) { should == 'tunnel' }
30
- its(['reverse_ipv6_http']) { should == 'tunnel' }
31
- its(['reverse_ipv6_https']) { should == 'tunnel' }
32
- its(['reverse_tcp']) { should == 'reverse' }
33
- its(['reverse_tcp_allports']) { should == 'reverse' }
34
- its(['reverse_tcp_double']) { should == 'reverse' }
35
- its(['reverse_tcp_double_ssl']) { should == 'reverse' }
36
- its(['reverse_tcp_ssl']) { should == 'reverse' }
37
- end
38
-
39
- context 'TYPES' do
40
- subject(:types) do
41
- described_class::TYPES
42
- end
43
-
44
- it { should include 'bind_tcp' }
45
- it { should include 'find_port' }
46
- it { should include 'find_shell' }
47
- it { should include 'find_tag' }
48
- it { should include 'none' }
49
- it { should include 'reverse_http' }
50
- it { should include 'reverse_https' }
51
- it { should include 'reverse_https_proxy' }
52
- it { should include 'reverse_ipv6_http' }
53
- it { should include 'reverse_ipv6_https' }
54
- it { should include 'reverse_tcp' }
55
- it { should include 'reverse_tcp_allports' }
56
- it { should include 'reverse_tcp_double' }
57
- it { should include 'reverse_tcp_double_ssl' }
58
- it { should include 'reverse_tcp_ssl' }
59
- end
60
- end
61
- end
@@ -1,183 +0,0 @@
1
- require 'spec_helper'
2
-
3
- describe Metasploit::Model::Module::Instance,
4
- # setting the metadata type makes rspec-rails include RSpec::Rails::ModelExampleGroup, which includes a better
5
- # be_valid matcher that will print full error messages
6
- type: :model do
7
- subject(:module_instance) do
8
- FactoryGirl.build(:dummy_module_instance)
9
- end
10
-
11
- it_should_behave_like 'Metasploit::Model::Module::Instance',
12
- namespace_name: 'Dummy'
13
-
14
- it_should_behave_like 'Metasploit::Model::Module::Instance::ClassMethods' do
15
- let(:singleton_class) do
16
- described_class
17
- end
18
- end
19
-
20
- context 'module_types_that_allow' do
21
- subject(:module_types_that_allow) do
22
- described_class.module_types_that_allow(attribute)
23
- end
24
-
25
- context 'with actions' do
26
- let(:attribute) do
27
- :actions
28
- end
29
-
30
- it { should include 'auxiliary' }
31
- it { should_not include 'encoder' }
32
- it { should_not include 'exploit' }
33
- it { should_not include 'nop' }
34
- it { should_not include 'payload' }
35
- it { should include 'post' }
36
- end
37
-
38
- context 'with module_architectures' do
39
- let(:attribute) do
40
- :module_architectures
41
- end
42
-
43
- it { should_not include 'auxiliary' }
44
- it { should include 'encoder' }
45
- it { should include 'exploit' }
46
- it { should include 'nop' }
47
- it { should include 'payload' }
48
- it { should include 'post' }
49
- end
50
-
51
- context 'with module_platforms' do
52
- let(:attribute) do
53
- :module_platforms
54
- end
55
-
56
- it { should_not include 'auxiliary' }
57
- it { should_not include 'encoder' }
58
- it { should include 'exploit' }
59
- it { should_not include 'nop' }
60
- it { should include 'payload' }
61
- it { should include 'post' }
62
- end
63
-
64
- context 'with module_references' do
65
- let(:attribute) do
66
- :module_references
67
- end
68
-
69
- it { should include 'auxiliary' }
70
- it { should_not include 'encoder' }
71
- it { should include 'exploit' }
72
- it { should_not include 'nop' }
73
- it { should_not include 'payload' }
74
- it { should include 'post' }
75
- end
76
-
77
- context 'with targets' do
78
- let(:attribute) do
79
- :targets
80
- end
81
-
82
- it { should_not include 'auxiliary' }
83
- it { should_not include 'encoder' }
84
- it { should include 'exploit' }
85
- it { should_not include 'nop' }
86
- it { should_not include 'payload' }
87
- it { should_not include 'post' }
88
- end
89
-
90
- context 'DYNAMIC_LENGTH_VALIDATION_OPTIONS_BY_MODULE_TYPE_BY_ATTRIBUTE' do
91
- let(:attribute) do
92
- :attribute
93
- end
94
-
95
- let(:module_type) do
96
- FactoryGirl.generate :metasploit_model_module_type
97
- end
98
-
99
- before(:each) do
100
- described_class::DYNAMIC_LENGTH_VALIDATION_OPTIONS_BY_MODULE_TYPE_BY_ATTRIBUTE.should_receive(:fetch).with(
101
- attribute
102
- ).and_return(
103
- dynamic_length_validation_options_by_module_type
104
- )
105
- end
106
-
107
- context 'with :is' do
108
- let(:dynamic_length_validation_options_by_module_type) do
109
- {
110
- module_type => {
111
- is: is
112
- }
113
- }
114
- end
115
-
116
- context '> 0' do
117
- let(:is) do
118
- 1
119
- end
120
-
121
- it 'includes module type' do
122
- expect(module_types_that_allow).to include(module_type)
123
- end
124
- end
125
-
126
- context '<= 0' do
127
- let(:is) do
128
- 0
129
- end
130
-
131
- it 'does not include module type' do
132
- expect(module_types_that_allow).not_to include(module_type)
133
- end
134
- end
135
- end
136
-
137
- context 'without :is' do
138
- context 'with :maximum' do
139
- let(:dynamic_length_validation_options_by_module_type) do
140
- {
141
- module_type => {
142
- maximum: maximum
143
- }
144
- }
145
- end
146
-
147
- context '> 0' do
148
- let(:maximum) do
149
- 1
150
- end
151
-
152
- it 'includes module type' do
153
- expect(module_types_that_allow).to include(module_type)
154
- end
155
- end
156
-
157
- context '<= 0' do
158
- let(:maximum) do
159
- 0
160
- end
161
-
162
- it 'does not include module type' do
163
- expect(module_types_that_allow).not_to include(module_type)
164
- end
165
- end
166
-
167
- end
168
-
169
- context 'without :maximum' do
170
- let(:dynamic_length_validation_options_by_module_type) do
171
- {
172
- module_type => {}
173
- }
174
- end
175
-
176
- it 'includes module type' do
177
- expect(module_types_that_allow).to include(module_type)
178
- end
179
- end
180
- end
181
- end
182
- end
183
- end