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,197 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operator::Deprecated::Author do
|
4
|
-
subject(:operator) do
|
5
|
-
described_class.new(
|
6
|
-
:klass => klass
|
7
|
-
)
|
8
|
-
end
|
9
|
-
|
10
|
-
let(:klass) do
|
11
|
-
Class.new
|
12
|
-
end
|
13
|
-
|
14
|
-
it { should be_a Metasploit::Model::Search::Operator::Delegation }
|
15
|
-
|
16
|
-
context '#children' do
|
17
|
-
include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
|
18
|
-
|
19
|
-
let(:author_class) do
|
20
|
-
Class.new
|
21
|
-
end
|
22
|
-
|
23
|
-
let(:authors_name_operator) do
|
24
|
-
Metasploit::Model::Search::Operator::Association.new(
|
25
|
-
:association => :authors,
|
26
|
-
:klass => klass,
|
27
|
-
:source_operator => name_operator
|
28
|
-
)
|
29
|
-
end
|
30
|
-
|
31
|
-
let(:domain_operator) do
|
32
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
33
|
-
:attribute => :domain,
|
34
|
-
:klass => email_address_class,
|
35
|
-
:type => :string
|
36
|
-
)
|
37
|
-
end
|
38
|
-
|
39
|
-
let(:email_address_class) do
|
40
|
-
Class.new
|
41
|
-
end
|
42
|
-
|
43
|
-
let(:email_addresses_domain_operator) do
|
44
|
-
Metasploit::Model::Search::Operator::Association.new(
|
45
|
-
:association => :email_addresses,
|
46
|
-
:klass => klass,
|
47
|
-
:source_operator => domain_operator
|
48
|
-
)
|
49
|
-
end
|
50
|
-
|
51
|
-
let(:email_addresses_local_operator) do
|
52
|
-
Metasploit::Model::Search::Operator::Association.new(
|
53
|
-
:association => :email_addresses,
|
54
|
-
:klass => klass,
|
55
|
-
:source_operator => local_operator
|
56
|
-
)
|
57
|
-
end
|
58
|
-
|
59
|
-
let(:local_operator) do
|
60
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
61
|
-
:attribute => :local,
|
62
|
-
:klass => klass,
|
63
|
-
:type => :string
|
64
|
-
)
|
65
|
-
end
|
66
|
-
|
67
|
-
let(:name_operator) do
|
68
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
69
|
-
:attribute => :name,
|
70
|
-
:klass => :author_class,
|
71
|
-
:type => :string
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
before(:each) do
|
76
|
-
operator.stub(:operator).with('authors.name').and_return(authors_name_operator)
|
77
|
-
operator.stub(:operator).with('email_addresses.domain').and_return(email_addresses_domain_operator)
|
78
|
-
operator.stub(:operator).with('email_addresses.local').and_return(email_addresses_local_operator)
|
79
|
-
end
|
80
|
-
|
81
|
-
context "with '@'" do
|
82
|
-
let(:formatted_value) do
|
83
|
-
"#{local}@#{domain}"
|
84
|
-
end
|
85
|
-
|
86
|
-
let(:local) do
|
87
|
-
'user'
|
88
|
-
end
|
89
|
-
|
90
|
-
let(:domain) do
|
91
|
-
'example.com'
|
92
|
-
end
|
93
|
-
|
94
|
-
context 'authors.name' do
|
95
|
-
subject(:operation) do
|
96
|
-
child('authors.name')
|
97
|
-
end
|
98
|
-
|
99
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
100
|
-
subject(:source_operation) {
|
101
|
-
operation.source_operation
|
102
|
-
}
|
103
|
-
|
104
|
-
it 'uses entire formatted value' do
|
105
|
-
expect(source_operation.value).to eq(formatted_value)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
end
|
109
|
-
|
110
|
-
context 'email_addresses.domain' do
|
111
|
-
subject(:operation) do
|
112
|
-
child('email_addresses.domain')
|
113
|
-
end
|
114
|
-
|
115
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
116
|
-
subject(:source_operation) {
|
117
|
-
operation.source_operation
|
118
|
-
}
|
119
|
-
|
120
|
-
it "uses portion of formatted value after '@'" do
|
121
|
-
expect(source_operation.value).to eq(domain)
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|
125
|
-
|
126
|
-
context 'email_addresses.local' do
|
127
|
-
subject(:operation) do
|
128
|
-
child('email_addresses.local')
|
129
|
-
end
|
130
|
-
|
131
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
132
|
-
subject(:source_operation) {
|
133
|
-
operation.source_operation
|
134
|
-
}
|
135
|
-
|
136
|
-
it "uses portion of formated value before '@'" do
|
137
|
-
expect(source_operation.value).to eq(local)
|
138
|
-
end
|
139
|
-
end
|
140
|
-
end
|
141
|
-
end
|
142
|
-
|
143
|
-
context "without '@'" do
|
144
|
-
let(:formatted_value) do
|
145
|
-
'local_or_handle'
|
146
|
-
end
|
147
|
-
|
148
|
-
context 'authors.name' do
|
149
|
-
subject(:operation) do
|
150
|
-
child('authors.name')
|
151
|
-
end
|
152
|
-
|
153
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
154
|
-
subject(:source_operation) {
|
155
|
-
operation.source_operation
|
156
|
-
}
|
157
|
-
|
158
|
-
it 'uses entire formatted value' do
|
159
|
-
expect(source_operation.value).to eq(formatted_value)
|
160
|
-
end
|
161
|
-
end
|
162
|
-
end
|
163
|
-
|
164
|
-
context 'email_addresses.domain' do
|
165
|
-
subject(:operation) do
|
166
|
-
child('email_addresses.domain')
|
167
|
-
end
|
168
|
-
|
169
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
170
|
-
subject(:source_operation) {
|
171
|
-
operation.source_operation
|
172
|
-
}
|
173
|
-
|
174
|
-
it 'uses entire formatted value' do
|
175
|
-
expect(source_operation.value).to eq(formatted_value)
|
176
|
-
end
|
177
|
-
end
|
178
|
-
end
|
179
|
-
|
180
|
-
context 'email_addresses.local' do
|
181
|
-
subject(:operation) do
|
182
|
-
child('email_addresses.local')
|
183
|
-
end
|
184
|
-
|
185
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
186
|
-
subject(:source_operation) {
|
187
|
-
operation.source_operation
|
188
|
-
}
|
189
|
-
|
190
|
-
it 'uses entire formatted value' do
|
191
|
-
expect(source_operation.value).to eq(formatted_value)
|
192
|
-
end
|
193
|
-
end
|
194
|
-
end
|
195
|
-
end
|
196
|
-
end
|
197
|
-
end
|
@@ -1,135 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operator::Deprecated::Authority do
|
4
|
-
subject(:operator) do
|
5
|
-
described_class.new(
|
6
|
-
:abbreviation => abbreviation,
|
7
|
-
:klass => klass
|
8
|
-
)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:abbreviation) do
|
12
|
-
FactoryGirl.generate :metasploit_model_authority_abbreviation
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:klass) do
|
16
|
-
Class.new
|
17
|
-
end
|
18
|
-
|
19
|
-
let(:search_i18n_scope) do
|
20
|
-
'search.i18n.scope'
|
21
|
-
end
|
22
|
-
|
23
|
-
before(:each) do
|
24
|
-
klass.stub(:search_i18n_scope => search_i18n_scope)
|
25
|
-
end
|
26
|
-
|
27
|
-
it { should be_a Metasploit::Model::Search::Operator::Delegation }
|
28
|
-
|
29
|
-
context 'validations' do
|
30
|
-
it { should validate_presence_of :abbreviation }
|
31
|
-
end
|
32
|
-
|
33
|
-
context '#name' do
|
34
|
-
subject(:name) do
|
35
|
-
operator.name
|
36
|
-
end
|
37
|
-
|
38
|
-
it 'should be #abbreviation' do
|
39
|
-
name.should == abbreviation
|
40
|
-
end
|
41
|
-
end
|
42
|
-
|
43
|
-
context '#operate_on' do
|
44
|
-
subject(:operations) do
|
45
|
-
operator.operate_on(formatted_value)
|
46
|
-
end
|
47
|
-
|
48
|
-
def operation_named(formatted_operator)
|
49
|
-
operations.find { |operation|
|
50
|
-
operation.operator.name == formatted_operator.to_sym
|
51
|
-
}
|
52
|
-
end
|
53
|
-
|
54
|
-
let(:abbreviation_operator) do
|
55
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
56
|
-
:attribute => :abbreviation,
|
57
|
-
:klass => authority_class,
|
58
|
-
:type => :string
|
59
|
-
)
|
60
|
-
end
|
61
|
-
|
62
|
-
let(:authority_class) do
|
63
|
-
Class.new
|
64
|
-
end
|
65
|
-
|
66
|
-
let(:authorities_abbreviation_operator) do
|
67
|
-
Metasploit::Model::Search::Operator::Association.new(
|
68
|
-
:association => :authorities,
|
69
|
-
:klass => klass,
|
70
|
-
:source_operator => abbreviation_operator
|
71
|
-
)
|
72
|
-
end
|
73
|
-
|
74
|
-
let(:designation_operator) do
|
75
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
76
|
-
:attribute => :designation,
|
77
|
-
:klass => reference_class,
|
78
|
-
:type => :string
|
79
|
-
)
|
80
|
-
end
|
81
|
-
|
82
|
-
let(:formatted_value) do
|
83
|
-
FactoryGirl.generate :metasploit_model_reference_designation
|
84
|
-
end
|
85
|
-
|
86
|
-
let(:reference_class) do
|
87
|
-
Class.new
|
88
|
-
end
|
89
|
-
|
90
|
-
let(:references_designation_operator) do
|
91
|
-
Metasploit::Model::Search::Operator::Association.new(
|
92
|
-
:association => :references,
|
93
|
-
:klass => klass,
|
94
|
-
:source_operator => designation_operator
|
95
|
-
)
|
96
|
-
end
|
97
|
-
|
98
|
-
before(:each) do
|
99
|
-
operator.stub(:operator).with('authorities.abbreviation').and_return(authorities_abbreviation_operator)
|
100
|
-
operator.stub(:operator).with('references.designation').and_return(references_designation_operator)
|
101
|
-
end
|
102
|
-
|
103
|
-
context 'authorities.abbreviation' do
|
104
|
-
subject(:operation) do
|
105
|
-
operation_named('authorities.abbreviation')
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
109
|
-
subject(:source_operation) {
|
110
|
-
operation.source_operation
|
111
|
-
}
|
112
|
-
|
113
|
-
it 'uses #abbreviation for value' do
|
114
|
-
expect(source_operation.value).to eq(abbreviation)
|
115
|
-
end
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context 'references.designation' do
|
120
|
-
subject(:operation) do
|
121
|
-
operation_named('references.designation')
|
122
|
-
end
|
123
|
-
|
124
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
125
|
-
subject(:source_operation) {
|
126
|
-
operation.source_operation
|
127
|
-
}
|
128
|
-
|
129
|
-
it 'uses formatted value for value' do
|
130
|
-
expect(source_operation.value).to eq(formatted_value)
|
131
|
-
end
|
132
|
-
end
|
133
|
-
end
|
134
|
-
end
|
135
|
-
end
|
@@ -1,124 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Metasploit::Model::Search::Operator::Deprecated::Platform do
|
4
|
-
subject(:operator) do
|
5
|
-
described_class.new(
|
6
|
-
:klass => klass,
|
7
|
-
:name => name
|
8
|
-
)
|
9
|
-
end
|
10
|
-
|
11
|
-
let(:klass) do
|
12
|
-
Class.new
|
13
|
-
end
|
14
|
-
|
15
|
-
let(:name) do
|
16
|
-
['os', 'platform'].sample
|
17
|
-
end
|
18
|
-
|
19
|
-
it { should be_a Metasploit::Model::Search::Operator::Group::Union }
|
20
|
-
|
21
|
-
context 'CONSTANTS' do
|
22
|
-
context 'FORMATTED_OPERATORS' do
|
23
|
-
subject(:formatted_operators) do
|
24
|
-
described_class::FORMATTED_OPERATORS
|
25
|
-
end
|
26
|
-
|
27
|
-
it { should include 'platforms.fully_qualified_name' }
|
28
|
-
it { should include 'targets.name' }
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
context 'validations' do
|
33
|
-
it { should validate_presence_of :name }
|
34
|
-
end
|
35
|
-
|
36
|
-
context '#children' do
|
37
|
-
include_context 'Metasploit::Model::Search::Operator::Group::Union#children'
|
38
|
-
|
39
|
-
let(:formatted_value) do
|
40
|
-
'platform_or_target'
|
41
|
-
end
|
42
|
-
|
43
|
-
let(:platform_class) do
|
44
|
-
Class.new
|
45
|
-
end
|
46
|
-
|
47
|
-
let(:platform_fully_qualified_name_operator) do
|
48
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
49
|
-
:attribute => :fully_qualified_name,
|
50
|
-
:klass => platform_class,
|
51
|
-
:type => :string
|
52
|
-
)
|
53
|
-
end
|
54
|
-
|
55
|
-
let(:platforms_fully_qualified_name_operator) do
|
56
|
-
Metasploit::Model::Search::Operator::Association.new(
|
57
|
-
:association => :platforms,
|
58
|
-
:klass => klass,
|
59
|
-
:source_operator => platform_fully_qualified_name_operator
|
60
|
-
)
|
61
|
-
end
|
62
|
-
|
63
|
-
let(:target_class) do
|
64
|
-
Class.new
|
65
|
-
end
|
66
|
-
|
67
|
-
let(:target_name_operator) do
|
68
|
-
Metasploit::Model::Search::Operator::Attribute.new(
|
69
|
-
:attribute => :name,
|
70
|
-
:klass => target_class,
|
71
|
-
:type => :string
|
72
|
-
)
|
73
|
-
end
|
74
|
-
|
75
|
-
let(:targets_name_operator) do
|
76
|
-
Metasploit::Model::Search::Operator::Association.new(
|
77
|
-
:association => :targets,
|
78
|
-
:klass => klass,
|
79
|
-
:source_operator => target_name_operator
|
80
|
-
)
|
81
|
-
end
|
82
|
-
|
83
|
-
before(:each) do
|
84
|
-
operator.stub(:operator).with(
|
85
|
-
'platforms.fully_qualified_name'
|
86
|
-
).and_return(
|
87
|
-
platforms_fully_qualified_name_operator
|
88
|
-
)
|
89
|
-
operator.stub(:operator).with('targets.name').and_return(targets_name_operator)
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'platforms.fully_qualified_name' do
|
93
|
-
subject(:operation) do
|
94
|
-
child('platforms.fully_qualified_name')
|
95
|
-
end
|
96
|
-
|
97
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
98
|
-
subject(:source_operation) {
|
99
|
-
operation.source_operation
|
100
|
-
}
|
101
|
-
|
102
|
-
it 'uses formatted value for value' do
|
103
|
-
expect(source_operation.value).to eq(formatted_value)
|
104
|
-
end
|
105
|
-
end
|
106
|
-
end
|
107
|
-
|
108
|
-
context 'targets.name' do
|
109
|
-
subject(:operation) do
|
110
|
-
child('targets.name')
|
111
|
-
end
|
112
|
-
|
113
|
-
context 'Metasploit::Model::Search::Operation::Association#source_operation' do
|
114
|
-
subject(:source_operation) {
|
115
|
-
operation.source_operation
|
116
|
-
}
|
117
|
-
|
118
|
-
it 'uses formatted value for value' do
|
119
|
-
expect(source_operation.value).to eq(formatted_value)
|
120
|
-
end
|
121
|
-
end
|
122
|
-
end
|
123
|
-
end
|
124
|
-
end
|