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.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/config/locales/en.yml +0 -171
- data/lib/metasploit/model.rb +0 -2
- data/lib/metasploit/model/spec.rb +0 -130
- data/lib/metasploit/model/version.rb +1 -1
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +4 -6
- data/spec/support/shared/examples/metasploit/model/translation.rb +1 -1
- data/spec/support/shared/examples/search_association.rb +1 -1
- data/spec/support/shared/examples/search_with.rb +4 -2
- metadata +2 -348
- data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -125
- data/app/models/metasploit/model/module/class/spec/template.rb +0 -92
- data/app/models/metasploit/model/module/instance/spec/template.rb +0 -97
- data/app/models/metasploit/model/spec/template.rb +0 -277
- data/app/validators/derivation_validator.rb +0 -17
- data/app/validators/dynamic_length_validator.rb +0 -45
- data/lib/metasploit/model/architecture.rb +0 -342
- data/lib/metasploit/model/author.rb +0 -54
- data/lib/metasploit/model/authority.rb +0 -141
- data/lib/metasploit/model/authority/bid.rb +0 -10
- data/lib/metasploit/model/authority/cve.rb +0 -10
- data/lib/metasploit/model/authority/msb.rb +0 -10
- data/lib/metasploit/model/authority/osvdb.rb +0 -10
- data/lib/metasploit/model/authority/pmasa.rb +0 -10
- data/lib/metasploit/model/authority/secunia.rb +0 -10
- data/lib/metasploit/model/authority/us_cert_vu.rb +0 -10
- data/lib/metasploit/model/authority/waraxe.rb +0 -31
- data/lib/metasploit/model/authority/zdi.rb +0 -10
- data/lib/metasploit/model/derivation.rb +0 -109
- data/lib/metasploit/model/derivation/full_name.rb +0 -19
- data/lib/metasploit/model/email_address.rb +0 -124
- data/lib/metasploit/model/module.rb +0 -20
- data/lib/metasploit/model/module/action.rb +0 -52
- data/lib/metasploit/model/module/ancestor.rb +0 -491
- data/lib/metasploit/model/module/ancestor/spec.rb +0 -6
- data/lib/metasploit/model/module/architecture.rb +0 -34
- data/lib/metasploit/model/module/author.rb +0 -40
- data/lib/metasploit/model/module/class.rb +0 -403
- data/lib/metasploit/model/module/class/spec.rb +0 -6
- data/lib/metasploit/model/module/handler.rb +0 -29
- data/lib/metasploit/model/module/instance.rb +0 -622
- data/lib/metasploit/model/module/instance/spec.rb +0 -6
- data/lib/metasploit/model/module/path.rb +0 -159
- data/lib/metasploit/model/module/platform.rb +0 -32
- data/lib/metasploit/model/module/rank.rb +0 -85
- data/lib/metasploit/model/module/reference.rb +0 -32
- data/lib/metasploit/model/module/stance.rb +0 -16
- data/lib/metasploit/model/module/target.rb +0 -78
- data/lib/metasploit/model/module/target/architecture.rb +0 -34
- data/lib/metasploit/model/module/target/platform.rb +0 -34
- data/lib/metasploit/model/module/type.rb +0 -38
- data/lib/metasploit/model/platform.rb +0 -246
- data/lib/metasploit/model/real_pathname.rb +0 -16
- data/lib/metasploit/model/reference.rb +0 -104
- data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +0 -174
- data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +0 -222
- data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +0 -201
- data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +0 -62
- data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +0 -197
- data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +0 -135
- data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +0 -124
- data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +0 -387
- data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +0 -399
- data/spec/app/models/metasploit/model/spec/template_spec.rb +0 -23
- data/spec/app/validators/derivation_validator_spec.rb +0 -92
- data/spec/app/validators/dynamic_length_validator_spec.rb +0 -293
- data/spec/dummy/app/models/dummy/architecture.rb +0 -92
- data/spec/dummy/app/models/dummy/author.rb +0 -15
- data/spec/dummy/app/models/dummy/authority.rb +0 -130
- data/spec/dummy/app/models/dummy/email_address.rb +0 -27
- data/spec/dummy/app/models/dummy/module/action.rb +0 -25
- data/spec/dummy/app/models/dummy/module/ancestor.rb +0 -67
- data/spec/dummy/app/models/dummy/module/architecture.rb +0 -19
- data/spec/dummy/app/models/dummy/module/author.rb +0 -28
- data/spec/dummy/app/models/dummy/module/class.rb +0 -69
- data/spec/dummy/app/models/dummy/module/instance.rb +0 -209
- data/spec/dummy/app/models/dummy/module/path.rb +0 -64
- data/spec/dummy/app/models/dummy/module/platform.rb +0 -19
- data/spec/dummy/app/models/dummy/module/rank.rb +0 -44
- data/spec/dummy/app/models/dummy/module/reference.rb +0 -19
- data/spec/dummy/app/models/dummy/module/target.rb +0 -62
- data/spec/dummy/app/models/dummy/module/target/architecture.rb +0 -19
- data/spec/dummy/app/models/dummy/module/target/platform.rb +0 -19
- data/spec/dummy/app/models/dummy/platform.rb +0 -58
- data/spec/dummy/app/models/dummy/reference.rb +0 -31
- data/spec/dummy/spec/factories/dummy/architectures.rb +0 -13
- data/spec/dummy/spec/factories/dummy/authorities.rb +0 -32
- data/spec/dummy/spec/factories/dummy/authors.rb +0 -8
- data/spec/dummy/spec/factories/dummy/email_addresses.rb +0 -8
- data/spec/dummy/spec/factories/dummy/module/actions.rb +0 -13
- data/spec/dummy/spec/factories/dummy/module/ancestors.rb +0 -45
- data/spec/dummy/spec/factories/dummy/module/architectures.rb +0 -35
- data/spec/dummy/spec/factories/dummy/module/authors.rb +0 -10
- data/spec/dummy/spec/factories/dummy/module/classes.rb +0 -40
- data/spec/dummy/spec/factories/dummy/module/instances.rb +0 -86
- data/spec/dummy/spec/factories/dummy/module/paths.rb +0 -16
- data/spec/dummy/spec/factories/dummy/module/platforms.rb +0 -35
- data/spec/dummy/spec/factories/dummy/module/ranks.rb +0 -14
- data/spec/dummy/spec/factories/dummy/module/references.rb +0 -17
- data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +0 -40
- data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +0 -41
- data/spec/dummy/spec/factories/dummy/module/targets.rb +0 -46
- data/spec/dummy/spec/factories/dummy/platforms.rb +0 -3
- data/spec/dummy/spec/factories/dummy/references.rb +0 -26
- data/spec/factories/metasploit/model/architectures.rb +0 -6
- data/spec/factories/metasploit/model/authorities.rb +0 -28
- data/spec/factories/metasploit/model/authors.rb +0 -9
- data/spec/factories/metasploit/model/email_addresses.rb +0 -14
- data/spec/factories/metasploit/model/module/actions.rb +0 -9
- data/spec/factories/metasploit/model/module/ancestors.rb +0 -180
- data/spec/factories/metasploit/model/module/architectures.rb +0 -15
- data/spec/factories/metasploit/model/module/classes.rb +0 -47
- data/spec/factories/metasploit/model/module/handlers.rb +0 -3
- data/spec/factories/metasploit/model/module/instances.rb +0 -83
- data/spec/factories/metasploit/model/module/paths.rb +0 -51
- data/spec/factories/metasploit/model/module/platforms.rb +0 -15
- data/spec/factories/metasploit/model/module/ranks.rb +0 -9
- data/spec/factories/metasploit/model/module/references.rb +0 -11
- data/spec/factories/metasploit/model/module/stances.rb +0 -3
- data/spec/factories/metasploit/model/module/targets.rb +0 -22
- data/spec/factories/metasploit/model/module/types.rb +0 -5
- data/spec/factories/metasploit/model/references.rb +0 -88
- data/spec/lib/metasploit/model/architecture_spec.rb +0 -52
- data/spec/lib/metasploit/model/author_spec.rb +0 -6
- data/spec/lib/metasploit/model/authority/bid_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/cve_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/msb_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/osvdb_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/pmasa_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/secunia_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/waraxe_spec.rb +0 -51
- data/spec/lib/metasploit/model/authority/zdi_spec.rb +0 -21
- data/spec/lib/metasploit/model/authority_spec.rb +0 -10
- data/spec/lib/metasploit/model/derivation/full_name_spec.rb +0 -75
- data/spec/lib/metasploit/model/derivation_spec.rb +0 -217
- data/spec/lib/metasploit/model/email_address_spec.rb +0 -19
- data/spec/lib/metasploit/model/module/action_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/ancestor_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/architecture_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/author_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/class_spec.rb +0 -19
- data/spec/lib/metasploit/model/module/handler_spec.rb +0 -61
- data/spec/lib/metasploit/model/module/instance_spec.rb +0 -183
- data/spec/lib/metasploit/model/module/path_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/platform_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/rank_spec.rb +0 -29
- data/spec/lib/metasploit/model/module/reference_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/stance_spec.rb +0 -30
- data/spec/lib/metasploit/model/module/target/architecture_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/target/platform_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/target_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/type_spec.rb +0 -125
- data/spec/lib/metasploit/model/platform_spec.rb +0 -100
- data/spec/lib/metasploit/model/reference_spec.rb +0 -21
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +0 -12
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +0 -10
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +0 -15
- data/spec/support/shared/examples/derives.rb +0 -115
- data/spec/support/shared/examples/metasploit/model/architecture.rb +0 -425
- data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +0 -25
- data/spec/support/shared/examples/metasploit/model/author.rb +0 -27
- data/spec/support/shared/examples/metasploit/model/authority.rb +0 -124
- data/spec/support/shared/examples/metasploit/model/authority/seed.rb +0 -49
- data/spec/support/shared/examples/metasploit/model/email_address.rb +0 -220
- data/spec/support/shared/examples/metasploit/model/module/action.rb +0 -26
- data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +0 -2004
- data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +0 -63
- data/spec/support/shared/examples/metasploit/model/module/architecture.rb +0 -36
- data/spec/support/shared/examples/metasploit/model/module/author.rb +0 -29
- data/spec/support/shared/examples/metasploit/model/module/class.rb +0 -1514
- data/spec/support/shared/examples/metasploit/model/module/handler.rb +0 -21
- data/spec/support/shared/examples/metasploit/model/module/instance.rb +0 -1384
- data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +0 -537
- data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +0 -22
- data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +0 -38
- data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +0 -131
- data/spec/support/shared/examples/metasploit/model/module/path.rb +0 -493
- data/spec/support/shared/examples/metasploit/model/module/platform.rb +0 -36
- data/spec/support/shared/examples/metasploit/model/module/rank.rb +0 -92
- data/spec/support/shared/examples/metasploit/model/module/reference.rb +0 -16
- data/spec/support/shared/examples/metasploit/model/module/target.rb +0 -29
- data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +0 -56
- data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +0 -56
- data/spec/support/shared/examples/metasploit/model/platform.rb +0 -213
- data/spec/support/shared/examples/metasploit/model/real_pathname.rb +0 -29
- data/spec/support/shared/examples/metasploit/model/reference.rb +0 -410
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +0 -44
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +0 -72
- data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +0 -9
- data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +0 -8
- data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +0 -6
- data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +0 -3
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +0 -5
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +0 -4
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +0 -20
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +0 -1
- 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,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,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
|