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