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,14 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
sequence :metasploit_model_email_address_domain do |n|
|
3
|
-
"metasploit-model-email-address-domain#{n}.com"
|
4
|
-
end
|
5
|
-
|
6
|
-
sequence :metasploit_model_email_address_local do |n|
|
7
|
-
"metasploit.model.email.address.local+#{n}"
|
8
|
-
end
|
9
|
-
|
10
|
-
trait :metasploit_model_email_address do
|
11
|
-
domain { generate :metasploit_model_email_address_domain }
|
12
|
-
local { generate :metasploit_model_email_address_local }
|
13
|
-
end
|
14
|
-
end
|
@@ -1,180 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
sequence :metasploit_model_module_ancestor_handler_type do |n|
|
3
|
-
"metasploit_model_module_ancestor_handler_type#{n}"
|
4
|
-
end
|
5
|
-
|
6
|
-
minimum_version = 1
|
7
|
-
maximum_version = 4
|
8
|
-
range = maximum_version - minimum_version + 1
|
9
|
-
|
10
|
-
sequence :metasploit_model_module_ancestor_metasploit_module_relative_name do |n|
|
11
|
-
version = (n % range) + minimum_version
|
12
|
-
|
13
|
-
"Metasploit#{version}"
|
14
|
-
end
|
15
|
-
|
16
|
-
sequence :metasploit_model_module_ancestor_payload_type, Metasploit::Model::Module::Ancestor::PAYLOAD_TYPES.cycle
|
17
|
-
|
18
|
-
sequence :metasploit_model_module_ancestor_reference_name do |n|
|
19
|
-
[
|
20
|
-
'metasploit',
|
21
|
-
'model',
|
22
|
-
'module',
|
23
|
-
'ancestor',
|
24
|
-
'reference',
|
25
|
-
"name#{n}"
|
26
|
-
].join('/')
|
27
|
-
end
|
28
|
-
|
29
|
-
sequence :metasploit_model_module_ancestor_non_payload_reference_name do |n|
|
30
|
-
[
|
31
|
-
'mdm',
|
32
|
-
'module',
|
33
|
-
'ancestor',
|
34
|
-
'non',
|
35
|
-
'payload',
|
36
|
-
'reference',
|
37
|
-
"name#{n}"
|
38
|
-
].join('/')
|
39
|
-
end
|
40
|
-
|
41
|
-
payload_type_directories = Metasploit::Model::Module::Ancestor::PAYLOAD_TYPES.map(&:pluralize)
|
42
|
-
|
43
|
-
sequence :metasploit_model_module_ancestor_payload_reference_name do |n|
|
44
|
-
payload_type_directory = payload_type_directories[n % payload_type_directories.length]
|
45
|
-
|
46
|
-
[
|
47
|
-
payload_type_directory,
|
48
|
-
'metasploit',
|
49
|
-
'model',
|
50
|
-
'module',
|
51
|
-
'ancestor',
|
52
|
-
'payload',
|
53
|
-
'reference',
|
54
|
-
"name#{n}"
|
55
|
-
].join('/')
|
56
|
-
end
|
57
|
-
|
58
|
-
sequence :metasploit_model_module_ancestor_relative_payload_name do |n|
|
59
|
-
[
|
60
|
-
'metasploit',
|
61
|
-
'model',
|
62
|
-
'module',
|
63
|
-
'ancestor',
|
64
|
-
'relative',
|
65
|
-
'payload',
|
66
|
-
"name#{n}"
|
67
|
-
].join('/')
|
68
|
-
end
|
69
|
-
|
70
|
-
trait :metasploit_model_module_ancestor do
|
71
|
-
#
|
72
|
-
# Attributes
|
73
|
-
#
|
74
|
-
|
75
|
-
module_type { generate :metasploit_model_module_type }
|
76
|
-
|
77
|
-
ignore do
|
78
|
-
# depends on module_type
|
79
|
-
payload_type {
|
80
|
-
if payload?
|
81
|
-
generate :metasploit_model_module_ancestor_payload_type
|
82
|
-
else
|
83
|
-
nil
|
84
|
-
end
|
85
|
-
}
|
86
|
-
|
87
|
-
#
|
88
|
-
# Callback helpers
|
89
|
-
#
|
90
|
-
|
91
|
-
before_write_template {
|
92
|
-
->(module_ancestor, evaluator){}
|
93
|
-
}
|
94
|
-
write_template {
|
95
|
-
->(module_ancestor, evaluator){
|
96
|
-
Metasploit::Model::Module::Ancestor::Spec::Template.write(module_ancestor: module_ancestor)
|
97
|
-
}
|
98
|
-
}
|
99
|
-
end
|
100
|
-
|
101
|
-
# depends on module_type
|
102
|
-
reference_name {
|
103
|
-
if payload?
|
104
|
-
payload_type_directory = payload_type.pluralize
|
105
|
-
relative_payload_name = generate :metasploit_model_module_ancestor_relative_payload_name
|
106
|
-
|
107
|
-
[
|
108
|
-
payload_type_directory,
|
109
|
-
relative_payload_name
|
110
|
-
].join('/')
|
111
|
-
else
|
112
|
-
generate :metasploit_model_module_ancestor_non_payload_reference_name
|
113
|
-
end
|
114
|
-
}
|
115
|
-
|
116
|
-
# depends on derived_payload_type which depends on reference_name
|
117
|
-
handler_type {
|
118
|
-
# can't use #handled? because it will check payload_type on model, not ignored field in factory, so use
|
119
|
-
# .handled?
|
120
|
-
if @instance.class.handled?(:module_type => module_type, :payload_type => derived_payload_type)
|
121
|
-
generate :metasploit_model_module_ancestor_handler_type
|
122
|
-
else
|
123
|
-
nil
|
124
|
-
end
|
125
|
-
}
|
126
|
-
|
127
|
-
#
|
128
|
-
# Callbacks
|
129
|
-
#
|
130
|
-
|
131
|
-
after(:build) do |module_ancestor, evaluator|
|
132
|
-
instance_exec(module_ancestor, evaluator, &evaluator.before_write_template)
|
133
|
-
instance_exec(module_ancestor, evaluator, &evaluator.write_template)
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
trait :non_payload_metasploit_model_module_ancestor do
|
138
|
-
module_type { generate :metasploit_model_non_payload_module_type }
|
139
|
-
|
140
|
-
ignore do
|
141
|
-
payload_type nil
|
142
|
-
end
|
143
|
-
end
|
144
|
-
|
145
|
-
trait :payload_metasploit_model_module_ancestor do
|
146
|
-
module_type 'payload'
|
147
|
-
|
148
|
-
ignore do
|
149
|
-
payload_type { generate :metasploit_model_module_ancestor_payload_type }
|
150
|
-
end
|
151
|
-
|
152
|
-
reference_name {
|
153
|
-
payload_type_directory = payload_type.pluralize
|
154
|
-
relative_payload_name = generate :metasploit_model_module_ancestor_relative_payload_name
|
155
|
-
|
156
|
-
[
|
157
|
-
payload_type_directory,
|
158
|
-
relative_payload_name
|
159
|
-
].join('/')
|
160
|
-
}
|
161
|
-
end
|
162
|
-
|
163
|
-
trait :single_payload_metasploit_model_module_ancestor do
|
164
|
-
ignore do
|
165
|
-
payload_type 'single'
|
166
|
-
end
|
167
|
-
end
|
168
|
-
|
169
|
-
trait :stage_payload_metasploit_model_module_ancestor do
|
170
|
-
ignore do
|
171
|
-
payload_type 'stage'
|
172
|
-
end
|
173
|
-
end
|
174
|
-
|
175
|
-
trait :stager_payload_metasploit_model_module_ancestor do
|
176
|
-
ignore do
|
177
|
-
payload_type 'stager'
|
178
|
-
end
|
179
|
-
end
|
180
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
module_architectures_module_types = Metasploit::Model::Module::Instance.module_types_that_allow(:module_architectures)
|
3
|
-
targets_module_types = Metasploit::Model::Module::Instance.module_types_that_allow(:targets)
|
4
|
-
|
5
|
-
# have to remove target supporting types so that target architectures won't interfere with module architectures
|
6
|
-
metasploit_model_module_architecture_module_types = module_architectures_module_types - targets_module_types
|
7
|
-
|
8
|
-
sequence :metasploit_model_module_architecture_module_type, metasploit_model_module_architecture_module_types.cycle
|
9
|
-
|
10
|
-
trait :metasploit_model_module_architecture do
|
11
|
-
ignore do
|
12
|
-
module_type { generate :metasploit_model_module_architecture_module_type }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,47 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
sequence :metasploit_model_module_class_payload_type, Metasploit::Model::Module::Class::PAYLOAD_TYPES.cycle
|
3
|
-
|
4
|
-
trait :metasploit_model_module_class do
|
5
|
-
#
|
6
|
-
# Attributes
|
7
|
-
#
|
8
|
-
|
9
|
-
# Don't set full_name: before_validation will derive it from {Metasploit::Model::Module::Class#module_type} and
|
10
|
-
# {Metasploit::Model::Module::Class::reference_name}.
|
11
|
-
|
12
|
-
ignore do
|
13
|
-
# derives from associations in instance, so don't set on instance
|
14
|
-
module_type { generate :metasploit_model_module_type }
|
15
|
-
|
16
|
-
# depends on module_type
|
17
|
-
# ignored because model attribute will derived from reference_name, this factory attribute is used to generate
|
18
|
-
# the correct reference_name.
|
19
|
-
payload_type {
|
20
|
-
# module_type is factory attribute, not model attribute
|
21
|
-
if module_type == Metasploit::Model::Module::Type::PAYLOAD
|
22
|
-
generate :metasploit_model_module_class_payload_type
|
23
|
-
else
|
24
|
-
nil
|
25
|
-
end
|
26
|
-
}
|
27
|
-
|
28
|
-
#
|
29
|
-
# Callback helpers
|
30
|
-
#
|
31
|
-
|
32
|
-
before_write_template {
|
33
|
-
->(module_class, evaluator) {}
|
34
|
-
}
|
35
|
-
write_template {
|
36
|
-
->(module_class, evaluator) {
|
37
|
-
Metasploit::Model::Module::Class::Spec::Template.write(module_class: module_class)
|
38
|
-
}
|
39
|
-
}
|
40
|
-
end
|
41
|
-
|
42
|
-
after(:build) do |module_class, evaluator|
|
43
|
-
instance_exec(evaluator, evaluator, &evaluator.before_write_template)
|
44
|
-
instance_exec(evaluator, evaluator, &evaluator.write_template)
|
45
|
-
end
|
46
|
-
end
|
47
|
-
end
|
@@ -1,83 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
sequence :metasploit_model_module_instance_description do |n|
|
3
|
-
"Module Description #{n}"
|
4
|
-
end
|
5
|
-
|
6
|
-
sequence :metasploit_model_module_instance_disclosed_on do |n|
|
7
|
-
Date.today - n
|
8
|
-
end
|
9
|
-
|
10
|
-
sequence :metasploit_model_module_instance_license do |n|
|
11
|
-
"Module License #{n}"
|
12
|
-
end
|
13
|
-
|
14
|
-
sequence :metasploit_model_module_instance_name do |n|
|
15
|
-
"Module Name #{n}"
|
16
|
-
end
|
17
|
-
|
18
|
-
sequence :metasploit_model_module_instance_privileged, Metasploit::Model::Module::Instance::PRIVILEGES.cycle
|
19
|
-
|
20
|
-
total_architectures = Metasploit::Model::Architecture::ABBREVIATIONS.length
|
21
|
-
total_platforms = Metasploit::Model::Platform.fully_qualified_name_set.length
|
22
|
-
# chosen so that there is at least 1 element even if 0 is allowed so that factories always test that the associated
|
23
|
-
# records are handled.
|
24
|
-
minimum_with_elements = 1
|
25
|
-
# arbitrarily chosen maximum when there are a bounded total of the associated records. Most chosen because 3 will
|
26
|
-
# test that there is no 1 or 2 special casing make it work.
|
27
|
-
arbitrary_maximum = 3
|
28
|
-
arbitrary_supported_length = ->{
|
29
|
-
Random.rand(minimum_with_elements .. arbitrary_maximum)
|
30
|
-
}
|
31
|
-
|
32
|
-
trait :metasploit_model_module_instance do
|
33
|
-
ignore do
|
34
|
-
actions_length(&arbitrary_supported_length)
|
35
|
-
|
36
|
-
# this length is only used if supports?(:module_architectures) is true. It can be set to 0 when
|
37
|
-
# supports?(:module_architectures) is true to make the after(:build) skip building the module architectures automatically.
|
38
|
-
module_architectures_length {
|
39
|
-
Random.rand(minimum_with_elements .. total_architectures)
|
40
|
-
}
|
41
|
-
|
42
|
-
module_authors_length(&arbitrary_supported_length)
|
43
|
-
|
44
|
-
# this length is only used if supports?(:module_platforms) is true. It can be set to 0 when
|
45
|
-
# supports?(:module_platforms) is true to make the after(:build) skip building the module platforms automatically.
|
46
|
-
module_platforms_length {
|
47
|
-
Random.rand(minimum_with_elements .. total_platforms)
|
48
|
-
}
|
49
|
-
|
50
|
-
module_references_length(&arbitrary_supported_length)
|
51
|
-
targets_length(&arbitrary_supported_length)
|
52
|
-
|
53
|
-
#
|
54
|
-
# Callback helpers
|
55
|
-
#
|
56
|
-
|
57
|
-
# Can't use the after(:build) system because in Mdm, the associations need to be set before writing the template
|
58
|
-
before_write_template {
|
59
|
-
->(module_instance, _evaluator){}
|
60
|
-
}
|
61
|
-
write_template {
|
62
|
-
->(module_instance, _evaluator) {
|
63
|
-
Metasploit::Model::Module::Instance::Spec::Template.write(module_instance: module_instance)
|
64
|
-
}
|
65
|
-
}
|
66
|
-
end
|
67
|
-
|
68
|
-
#
|
69
|
-
# Attributes
|
70
|
-
#
|
71
|
-
|
72
|
-
description { generate :metasploit_model_module_instance_description }
|
73
|
-
disclosed_on { generate :metasploit_model_module_instance_disclosed_on }
|
74
|
-
license { generate :metasploit_model_module_instance_license }
|
75
|
-
name { generate :metasploit_model_module_instance_name }
|
76
|
-
privileged { generate :metasploit_model_module_instance_privileged }
|
77
|
-
|
78
|
-
after(:build) do |module_instance, evaluator|
|
79
|
-
instance_exec(module_instance, evaluator, &evaluator.before_write_template)
|
80
|
-
instance_exec(module_instance, evaluator, &evaluator.write_template)
|
81
|
-
end
|
82
|
-
end
|
83
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
sequence :metasploit_model_module_path_gem do |n|
|
3
|
-
"metasploit_model_module_path_gem#{n}"
|
4
|
-
end
|
5
|
-
|
6
|
-
sequence :metasploit_model_module_path_name do |n|
|
7
|
-
"metasploit_model_module_path_name#{n}"
|
8
|
-
end
|
9
|
-
|
10
|
-
sequence :metasploit_model_module_path_real_path do |n|
|
11
|
-
pathname = Metasploit::Model::Spec.temporary_pathname.join(
|
12
|
-
'metasploit',
|
13
|
-
'model',
|
14
|
-
'module',
|
15
|
-
'path',
|
16
|
-
'real',
|
17
|
-
'path',
|
18
|
-
n.to_s
|
19
|
-
)
|
20
|
-
Metasploit::Model::Spec::PathnameCollision.check!(pathname)
|
21
|
-
pathname.mkpath
|
22
|
-
|
23
|
-
pathname.to_path
|
24
|
-
end
|
25
|
-
|
26
|
-
sequence :metasploit_model_module_path_directory_real_path do |n|
|
27
|
-
pathname = Metasploit::Model::Spec.temporary_pathname.join(
|
28
|
-
'metasploit',
|
29
|
-
'model',
|
30
|
-
'module',
|
31
|
-
'path',
|
32
|
-
'directory',
|
33
|
-
'real',
|
34
|
-
'path',
|
35
|
-
n.to_s
|
36
|
-
)
|
37
|
-
Metasploit::Model::Spec::PathnameCollision.check!(pathname)
|
38
|
-
pathname.mkpath
|
39
|
-
|
40
|
-
pathname.to_path
|
41
|
-
end
|
42
|
-
|
43
|
-
trait :unnamed_metasploit_model_module_path do
|
44
|
-
real_path { generate :metasploit_model_module_path_real_path }
|
45
|
-
end
|
46
|
-
|
47
|
-
trait :named_metasploit_model_module_path do
|
48
|
-
gem { generate :metasploit_model_module_path_gem }
|
49
|
-
name { generate :metasploit_model_module_path_name }
|
50
|
-
end
|
51
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
module_platforms_module_types = Metasploit::Model::Module::Instance.module_types_that_allow(:module_platforms)
|
3
|
-
targets_module_types = Metasploit::Model::Module::Instance.module_types_that_allow(:targets)
|
4
|
-
|
5
|
-
# have to remove target supporting types so that target platforms won't interfere with module platforms
|
6
|
-
metasploit_model_module_platform_module_types = module_platforms_module_types - targets_module_types
|
7
|
-
|
8
|
-
sequence :metasploit_model_module_platform_module_type, metasploit_model_module_platform_module_types.cycle
|
9
|
-
|
10
|
-
trait :metasploit_model_module_platform do
|
11
|
-
ignore do
|
12
|
-
module_type { generate :metasploit_model_module_platform_module_type }
|
13
|
-
end
|
14
|
-
end
|
15
|
-
end
|
@@ -1,9 +0,0 @@
|
|
1
|
-
FactoryGirl.define do
|
2
|
-
number_by_name = Metasploit::Model::Module::Rank::NUMBER_BY_NAME
|
3
|
-
|
4
|
-
names = number_by_name.keys
|
5
|
-
sequence :metasploit_model_module_rank_name, names.cycle
|
6
|
-
|
7
|
-
numbers = number_by_name.values
|
8
|
-
sequence :metasploit_model_module_rank_number, numbers.cycle
|
9
|
-
end
|