metasploit-model 0.28.0 → 0.29.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- 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 +3 -349
- 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,159 +0,0 @@
|
|
1
|
-
# Concern for sharing common code between `Mdm::Module::Path` and `Metasploit::Framework::Module::Path`. Define
|
2
|
-
# {#gem}, {#name}, and {#real_path} by following the abstract instructions for each attribute.
|
3
|
-
module Metasploit::Model::Module::Path
|
4
|
-
extend ActiveModel::Naming
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
include Metasploit::Model::NilifyBlanks
|
8
|
-
include Metasploit::Model::Translation
|
9
|
-
|
10
|
-
included do
|
11
|
-
include ActiveModel::Dirty
|
12
|
-
include ActiveModel::MassAssignmentSecurity
|
13
|
-
include ActiveModel::Validations
|
14
|
-
include ActiveModel::Validations::Callbacks
|
15
|
-
include Metasploit::Model::RealPathname
|
16
|
-
|
17
|
-
#
|
18
|
-
# Callbacks
|
19
|
-
#
|
20
|
-
|
21
|
-
nilify_blank :gem,
|
22
|
-
:name
|
23
|
-
before_validation :normalize_real_path
|
24
|
-
|
25
|
-
#
|
26
|
-
# Mass Assignment Security
|
27
|
-
#
|
28
|
-
|
29
|
-
attr_accessible :gem
|
30
|
-
attr_accessible :name
|
31
|
-
attr_accessible :real_path
|
32
|
-
|
33
|
-
#
|
34
|
-
# Validations
|
35
|
-
#
|
36
|
-
|
37
|
-
validate :directory
|
38
|
-
validate :gem_and_name
|
39
|
-
end
|
40
|
-
|
41
|
-
#
|
42
|
-
# Attributes
|
43
|
-
#
|
44
|
-
|
45
|
-
# @!attribute [rw] gem
|
46
|
-
# @abstract In an ActiveModel, this should be an `attr_accessor :gem`. In an ActiveRecord, this should be a
|
47
|
-
# string gem column.
|
48
|
-
#
|
49
|
-
# The name of the gem that is adding this module path to metasploit-framework. For paths normally added by
|
50
|
-
# metasploit-framework itself, this would be `'metasploit-framework'`, while for Metasploit Pro this would be
|
51
|
-
# `'metasploit-pro'`. The name used for `gem` does not have to be a gem on rubygems, it just functions as a
|
52
|
-
# namespace for {#name} so that projects using metasploit-framework do not need to worry about collisions on
|
53
|
-
# {#name} which could disrupt the cache behavior.
|
54
|
-
#
|
55
|
-
# @return [String]
|
56
|
-
|
57
|
-
# @!attribute [rw] name
|
58
|
-
# @abstract In an ActiveModel, this should be an `attr_accessor :name`. In an ActiveRecord, this should be a
|
59
|
-
# string name column.
|
60
|
-
#
|
61
|
-
# The name of the module path scoped to {#gem}. {#gem} and {#name} uniquely identify this path so that if
|
62
|
-
# {#real_path} changes, the entire cache does not need to be invalidated because the change in {#real_path}
|
63
|
-
# will still be tied to the same ({#gem}, {#name}) tuple.
|
64
|
-
#
|
65
|
-
# @return [String]
|
66
|
-
|
67
|
-
# @!attribute [rw] real_path
|
68
|
-
# @abstract In an ActiveModel, this should be an `attr_accesor :real_path`. In an ActiveRecord, this should
|
69
|
-
# be a text real_path column.
|
70
|
-
#
|
71
|
-
# @note Non-real paths will be converted to real paths in a before validation callback, so take care to either
|
72
|
-
# pass real paths or pay attention when setting {#real_path} and then changing directories before
|
73
|
-
# validating.
|
74
|
-
#
|
75
|
-
# The real (absolute) path to module path.
|
76
|
-
#
|
77
|
-
# @return [String]
|
78
|
-
|
79
|
-
#
|
80
|
-
# Instance Methods
|
81
|
-
#
|
82
|
-
|
83
|
-
# Returns whether {#real_path} is a directory.
|
84
|
-
#
|
85
|
-
# @return [true] if {#real_path} is a directory.
|
86
|
-
# @return [false] if {#real_path} is not a directory.
|
87
|
-
def directory?
|
88
|
-
directory = false
|
89
|
-
|
90
|
-
if real_path and File.directory?(real_path)
|
91
|
-
directory = true
|
92
|
-
end
|
93
|
-
|
94
|
-
directory
|
95
|
-
end
|
96
|
-
|
97
|
-
# Returns whether is a named path.
|
98
|
-
#
|
99
|
-
# @return [false] if gem is blank or name is blank.
|
100
|
-
# @return [true] if gem is not blank and name is not blank.
|
101
|
-
def named?
|
102
|
-
named = false
|
103
|
-
|
104
|
-
if gem.present? and name.present?
|
105
|
-
named = true
|
106
|
-
end
|
107
|
-
|
108
|
-
named
|
109
|
-
end
|
110
|
-
|
111
|
-
# Returns whether was a named path. This is the equivalent of {#named?}, but checks the old, pre-change
|
112
|
-
# values for {#gem} and {#name}.
|
113
|
-
#
|
114
|
-
# @return [false] is gem_was is blank or name_was is blank.
|
115
|
-
# @return [true] if gem_was is not blank and name_was is not blank.
|
116
|
-
def was_named?
|
117
|
-
was_named = false
|
118
|
-
|
119
|
-
if gem_was.present? and name_was.present?
|
120
|
-
was_named = true
|
121
|
-
end
|
122
|
-
|
123
|
-
was_named
|
124
|
-
end
|
125
|
-
|
126
|
-
private
|
127
|
-
|
128
|
-
# Validates that either {#directory?} is `true`.
|
129
|
-
#
|
130
|
-
# @return [void]
|
131
|
-
def directory
|
132
|
-
unless directory?
|
133
|
-
errors[:real_path] << 'must be a directory'
|
134
|
-
end
|
135
|
-
end
|
136
|
-
|
137
|
-
# Validates that either both {#gem} and {#name} are present or both are `nil`.
|
138
|
-
#
|
139
|
-
# @return [void]
|
140
|
-
def gem_and_name
|
141
|
-
if name.present? and gem.blank?
|
142
|
-
errors[:gem] << "can't be blank if name is present"
|
143
|
-
end
|
144
|
-
|
145
|
-
if gem.present? and name.blank?
|
146
|
-
errors[:name] << "can't be blank if gem is present"
|
147
|
-
end
|
148
|
-
end
|
149
|
-
|
150
|
-
# If {#real_path} is set and exists on disk, then converts it to a real path to eliminate any symlinks.
|
151
|
-
#
|
152
|
-
# @return [void]
|
153
|
-
# @see Metasploit::Model::File.realpath
|
154
|
-
def normalize_real_path
|
155
|
-
if real_path and File.exist?(real_path)
|
156
|
-
self.real_path = Metasploit::Model::File.realpath(real_path)
|
157
|
-
end
|
158
|
-
end
|
159
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Joins {Metasploit::Model::Module::Instance} and {Metasploit::Model::Platform.}
|
2
|
-
module Metasploit::Model::Module::Platform
|
3
|
-
extend ActiveModel::Naming
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
include Metasploit::Model::Translation
|
7
|
-
|
8
|
-
included do
|
9
|
-
include ActiveModel::Validations
|
10
|
-
|
11
|
-
#
|
12
|
-
# Validations
|
13
|
-
#
|
14
|
-
|
15
|
-
validates :module_instance, :presence => true
|
16
|
-
validates :platform, :presence => true
|
17
|
-
end
|
18
|
-
|
19
|
-
#
|
20
|
-
# Associations
|
21
|
-
#
|
22
|
-
|
23
|
-
# @!attribute [rw] module_instance
|
24
|
-
# Module that supports {#platform}.
|
25
|
-
#
|
26
|
-
# @return [Metasploit::Model::Module::Instance]
|
27
|
-
|
28
|
-
# @!attribute [rw] platform
|
29
|
-
# Platform supported by {#module_instance}.
|
30
|
-
#
|
31
|
-
# @return [Metasploit::Model::Platform]
|
32
|
-
end
|
@@ -1,85 +0,0 @@
|
|
1
|
-
# Code shared between `Mdm::Module::Rank` and `Metasploit::Framework::Module::Rank`.
|
2
|
-
module Metasploit::Model::Module::Rank
|
3
|
-
extend ActiveModel::Naming
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
include Metasploit::Model::Translation
|
7
|
-
|
8
|
-
#
|
9
|
-
# CONSTANTS
|
10
|
-
#
|
11
|
-
|
12
|
-
# Regular expression to ensure that {#name} is a word starting with a capital letter
|
13
|
-
NAME_REGEXP = /\A[A-Z][a-z]+\Z/
|
14
|
-
|
15
|
-
# Converts {#name} to {#number}. Used for seeding. Seeds exist so that reports can use module_ranks to get the
|
16
|
-
# name of a rank without having to duplicate this constant.
|
17
|
-
NUMBER_BY_NAME = {
|
18
|
-
'Manual' => 0,
|
19
|
-
'Low' => 100,
|
20
|
-
'Average' => 200,
|
21
|
-
'Normal' => 300,
|
22
|
-
'Good' => 400,
|
23
|
-
'Great' => 500,
|
24
|
-
'Excellent' => 600
|
25
|
-
}
|
26
|
-
# Converts {#number} to {#name}. Used to convert *Ranking constants used in `Msf::Modules` back to Strings.
|
27
|
-
NAME_BY_NUMBER = NUMBER_BY_NAME.invert
|
28
|
-
|
29
|
-
included do
|
30
|
-
include ActiveModel::MassAssignmentSecurity
|
31
|
-
include ActiveModel::Validations
|
32
|
-
include Metasploit::Model::Search
|
33
|
-
|
34
|
-
#
|
35
|
-
# Mass Assignment Security
|
36
|
-
#
|
37
|
-
|
38
|
-
attr_accessible :name
|
39
|
-
attr_accessible :number
|
40
|
-
|
41
|
-
#
|
42
|
-
# Search Attributes
|
43
|
-
#
|
44
|
-
|
45
|
-
search_attribute :name, :type => :string
|
46
|
-
search_attribute :number, :type => :integer
|
47
|
-
|
48
|
-
#
|
49
|
-
# Validations
|
50
|
-
#
|
51
|
-
|
52
|
-
validates :name,
|
53
|
-
# To ensure NUMBER_BY_NAME and seeds stay in sync.
|
54
|
-
:inclusion => {
|
55
|
-
:in => NUMBER_BY_NAME.keys
|
56
|
-
},
|
57
|
-
# To ensure new seeds follow pattern.
|
58
|
-
:format => {
|
59
|
-
:with => NAME_REGEXP
|
60
|
-
}
|
61
|
-
validates :number,
|
62
|
-
# to ensure NUMBER_BY_NAME and seeds stay in sync.
|
63
|
-
:inclusion => {
|
64
|
-
:in => NUMBER_BY_NAME.values
|
65
|
-
},
|
66
|
-
# To ensure new seeds follow pattern.
|
67
|
-
:numericality => {
|
68
|
-
:only_integer => true
|
69
|
-
}
|
70
|
-
end
|
71
|
-
|
72
|
-
#
|
73
|
-
# Attributes
|
74
|
-
#
|
75
|
-
|
76
|
-
# @!attribute [rw] name
|
77
|
-
# The name of the rank.
|
78
|
-
#
|
79
|
-
# @return [String]
|
80
|
-
|
81
|
-
# @!attribute [rw] number
|
82
|
-
# The numerical value of the rank. Higher numbers are better.
|
83
|
-
#
|
84
|
-
# @return [Integer]
|
85
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
# Joins {Metasploit::Model::Module::Instance} and {Metasploit::Model::Reference}.
|
2
|
-
module Metasploit::Model::Module::Reference
|
3
|
-
extend ActiveModel::Naming
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
include Metasploit::Model::Translation
|
7
|
-
|
8
|
-
included do
|
9
|
-
include ActiveModel::Validations
|
10
|
-
|
11
|
-
#
|
12
|
-
# Validations
|
13
|
-
#
|
14
|
-
|
15
|
-
validates :module_instance, :presence => true
|
16
|
-
validates :reference, :presence => true
|
17
|
-
end
|
18
|
-
|
19
|
-
#
|
20
|
-
# Associations
|
21
|
-
#
|
22
|
-
|
23
|
-
# @!attribute [rw] module_instance
|
24
|
-
# {Metasploit::Model::Module::Instance Module} with {#reference}.
|
25
|
-
#
|
26
|
-
# @return [Metasploit::Model::Module::Instance]
|
27
|
-
|
28
|
-
# @!attribute [rw] reference
|
29
|
-
# {Metasploit::Model::Reference reference} to exploit or proof-of-concept (PoC) code for {#module_instance}.
|
30
|
-
#
|
31
|
-
# @return [Metasploit::Model::Reference]
|
32
|
-
end
|
@@ -1,16 +0,0 @@
|
|
1
|
-
# The types of stances a module can take, such as {PASSIVE} or {AGGRESSIVE}. Stances indicate whether or not the
|
2
|
-
# module triggers the vulnerability without waiting for one or more conditions to be met ({AGGRESSIVE}) or whether
|
3
|
-
# it must wait for certain conditions to be satisfied before the exploit can be initiated ({PASSIVE}).
|
4
|
-
module Metasploit::Model::Module::Stance
|
5
|
-
# The module does actively tries to trigger a vulnerability.
|
6
|
-
AGGRESSIVE = 'aggressive'
|
7
|
-
# The module doesn't actively attack and waits for interaction from the client or other entity before attempting
|
8
|
-
# to trigger a vulnerability
|
9
|
-
PASSIVE = 'passive'
|
10
|
-
|
11
|
-
# All stances.
|
12
|
-
ALL = [
|
13
|
-
AGGRESSIVE,
|
14
|
-
PASSIVE
|
15
|
-
]
|
16
|
-
end
|
@@ -1,78 +0,0 @@
|
|
1
|
-
# Code shared between `Mdm::Module::Target` and `Metasploit::Framework::Module::Target`.
|
2
|
-
module Metasploit::Model::Module::Target
|
3
|
-
extend ActiveModel::Naming
|
4
|
-
extend ActiveSupport::Autoload
|
5
|
-
extend ActiveSupport::Concern
|
6
|
-
|
7
|
-
include Metasploit::Model::Translation
|
8
|
-
|
9
|
-
autoload :Architecture
|
10
|
-
autoload :Platform
|
11
|
-
|
12
|
-
included do
|
13
|
-
include ActiveModel::MassAssignmentSecurity
|
14
|
-
include ActiveModel::Validations
|
15
|
-
include Metasploit::Model::Search
|
16
|
-
|
17
|
-
#
|
18
|
-
# Mass Assignment Security
|
19
|
-
#
|
20
|
-
|
21
|
-
attr_accessible :name
|
22
|
-
|
23
|
-
#
|
24
|
-
# Search Attributes
|
25
|
-
#
|
26
|
-
|
27
|
-
search_attribute :name, :type => :string
|
28
|
-
|
29
|
-
#
|
30
|
-
# Validators
|
31
|
-
#
|
32
|
-
|
33
|
-
validates :module_instance, :presence => true
|
34
|
-
validates :name, :presence => true
|
35
|
-
validates :target_architectures, presence: true
|
36
|
-
validates :target_platforms, presence: true
|
37
|
-
end
|
38
|
-
|
39
|
-
#
|
40
|
-
# Associations
|
41
|
-
#
|
42
|
-
|
43
|
-
# @!attribute [r] architectures
|
44
|
-
# Architectures that this target supports, either by being declared specifically for this target or because
|
45
|
-
# this target did not override architectures and so inheritted the architecture set from the class.
|
46
|
-
#
|
47
|
-
# @return [Array<Metasploit::Model::Architecture>]
|
48
|
-
|
49
|
-
# @!attribute [rw] module_instance
|
50
|
-
# Module where this target was declared.
|
51
|
-
#
|
52
|
-
# @return [Metasploit::Model::Module::Instance]
|
53
|
-
|
54
|
-
# @!attribute [r] platforms
|
55
|
-
# Platforms that this target supports, either by being declared specifically for this target or because this
|
56
|
-
# target did not override platforms and so inheritted the platform set from the class.
|
57
|
-
#
|
58
|
-
# @return [Array<Metasploit::Model::Platform>]
|
59
|
-
|
60
|
-
# @!attribute [rw] target_architectures
|
61
|
-
# Joins this target to its {#architectures}
|
62
|
-
#
|
63
|
-
# @return [Array<Metasploit::Model::Module::Target::Architecture]
|
64
|
-
|
65
|
-
# @!attribute [rw] target_platforms
|
66
|
-
# Joins this target to its {#platforms}
|
67
|
-
#
|
68
|
-
# @return [Array<Metasploit::Model::Module::Target::Platform>]
|
69
|
-
|
70
|
-
#
|
71
|
-
# Attributes
|
72
|
-
#
|
73
|
-
|
74
|
-
# @!attribute [rw] name
|
75
|
-
# The name of this target.
|
76
|
-
#
|
77
|
-
# @return [String]
|
78
|
-
end
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# Model that joins {Metasploit::Model::Architecture} and {Metasploit::Model::Module::Target}.
|
2
|
-
module Metasploit::Model::Module::Target::Architecture
|
3
|
-
extend ActiveModel::Naming
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
include Metasploit::Model::Translation
|
7
|
-
|
8
|
-
included do
|
9
|
-
include ActiveModel::Validations
|
10
|
-
|
11
|
-
#
|
12
|
-
# Validations
|
13
|
-
#
|
14
|
-
|
15
|
-
validates :architecture,
|
16
|
-
presence: true
|
17
|
-
validates :module_target,
|
18
|
-
presence: true
|
19
|
-
end
|
20
|
-
|
21
|
-
#
|
22
|
-
# Associations
|
23
|
-
#
|
24
|
-
|
25
|
-
# @!attribute [rw] architecture
|
26
|
-
# The architecture supported by the {#module_target}.
|
27
|
-
#
|
28
|
-
# @return [Metasploit::Model::Architecture]
|
29
|
-
|
30
|
-
# @!attribute [rw] module_target
|
31
|
-
# The module target that supports {#architecture}.
|
32
|
-
#
|
33
|
-
# @return [Metasploit::Model::Module::Target]
|
34
|
-
end
|