metasploit-model 0.27.3-java → 0.27.4-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/app/models/metasploit/model/association/reflection.rb +0 -3
- data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -3
- data/app/models/metasploit/model/module/class/spec/template.rb +0 -4
- data/app/models/metasploit/model/module/instance/spec/template.rb +0 -4
- data/app/models/metasploit/model/search/group/base.rb +0 -3
- data/app/models/metasploit/model/search/group/intersection.rb +0 -3
- data/app/models/metasploit/model/search/group/union.rb +0 -3
- data/app/models/metasploit/model/search/operation/association.rb +0 -2
- data/app/models/metasploit/model/search/operation/base.rb +0 -3
- data/app/models/metasploit/model/search/operation/boolean.rb +0 -2
- data/app/models/metasploit/model/search/operation/date.rb +0 -2
- data/app/models/metasploit/model/search/operation/group/base.rb +0 -2
- data/app/models/metasploit/model/search/operation/group/intersection.rb +0 -2
- data/app/models/metasploit/model/search/operation/group/union.rb +0 -2
- data/app/models/metasploit/model/search/operation/integer.rb +1 -5
- data/app/models/metasploit/model/search/operation/null.rb +0 -2
- data/app/models/metasploit/model/search/operation/set.rb +5 -2
- data/app/models/metasploit/model/search/operation/set/integer.rb +1 -3
- data/app/models/metasploit/model/search/operation/set/string.rb +1 -3
- data/app/models/metasploit/model/search/operation/string.rb +1 -5
- data/app/models/metasploit/model/search/operator/association.rb +0 -2
- data/app/models/metasploit/model/search/operator/attribute.rb +0 -2
- data/app/models/metasploit/model/search/operator/base.rb +0 -4
- data/app/models/metasploit/model/search/operator/delegation.rb +0 -2
- data/app/models/metasploit/model/search/operator/deprecated/app.rb +0 -2
- data/app/models/metasploit/model/search/operator/deprecated/author.rb +0 -2
- data/app/models/metasploit/model/search/operator/deprecated/authority.rb +0 -2
- data/app/models/metasploit/model/search/operator/deprecated/platform.rb +0 -2
- data/app/models/metasploit/model/search/operator/deprecated/ref.rb +0 -2
- data/app/models/metasploit/model/search/operator/deprecated/text.rb +0 -2
- data/app/models/metasploit/model/search/operator/group/base.rb +0 -2
- data/app/models/metasploit/model/search/operator/group/intersection.rb +0 -2
- data/app/models/metasploit/model/search/operator/group/union.rb +0 -2
- data/app/models/metasploit/model/search/operator/null.rb +0 -2
- data/app/models/metasploit/model/search/operator/single.rb +0 -2
- data/app/models/metasploit/model/search/query.rb +0 -3
- data/app/models/metasploit/model/spec/template.rb +0 -3
- data/app/models/metasploit/model/visitation/visitor.rb +0 -3
- data/lib/metasploit/model.rb +14 -8
- data/lib/metasploit/model/architecture.rb +320 -326
- data/lib/metasploit/model/association.rb +43 -46
- data/lib/metasploit/model/association/error.rb +29 -33
- data/lib/metasploit/model/association/tree.rb +119 -125
- data/lib/metasploit/model/author.rb +45 -51
- data/lib/metasploit/model/authority.rb +139 -146
- data/lib/metasploit/model/authority/bid.rb +0 -2
- data/lib/metasploit/model/authority/cve.rb +0 -2
- data/lib/metasploit/model/authority/msb.rb +0 -2
- data/lib/metasploit/model/authority/osvdb.rb +0 -2
- data/lib/metasploit/model/authority/pmasa.rb +0 -2
- data/lib/metasploit/model/authority/secunia.rb +0 -2
- data/lib/metasploit/model/authority/us_cert_vu.rb +0 -2
- data/lib/metasploit/model/authority/waraxe.rb +0 -2
- data/lib/metasploit/model/authority/zdi.rb +0 -2
- data/lib/metasploit/model/base.rb +0 -2
- data/lib/metasploit/model/derivation.rb +95 -99
- data/lib/metasploit/model/derivation/full_name.rb +16 -22
- data/lib/metasploit/model/email_address.rb +122 -128
- data/lib/metasploit/model/engine.rb +26 -21
- data/lib/metasploit/model/error.rb +3 -7
- data/lib/metasploit/model/file.rb +0 -2
- data/lib/metasploit/model/invalid.rb +11 -17
- data/lib/metasploit/model/login.rb +0 -3
- data/lib/metasploit/model/login/status.rb +0 -2
- data/lib/metasploit/model/module.rb +19 -23
- data/lib/metasploit/model/module/action.rb +50 -58
- data/lib/metasploit/model/module/ancestor.rb +456 -465
- data/lib/metasploit/model/module/ancestor/spec.rb +3 -2
- data/lib/metasploit/model/module/architecture.rb +27 -35
- data/lib/metasploit/model/module/author.rb +38 -47
- data/lib/metasploit/model/module/class.rb +358 -366
- data/lib/metasploit/model/module/class/spec.rb +3 -2
- data/lib/metasploit/model/module/handler.rb +28 -34
- data/lib/metasploit/model/module/instance.rb +586 -596
- data/lib/metasploit/model/module/instance/spec.rb +3 -2
- data/lib/metasploit/model/module/path.rb +157 -166
- data/lib/metasploit/model/module/platform.rb +25 -33
- data/lib/metasploit/model/module/rank.rb +71 -79
- data/lib/metasploit/model/module/reference.rb +25 -33
- data/lib/metasploit/model/module/stance.rb +15 -21
- data/lib/metasploit/model/module/target.rb +76 -84
- data/lib/metasploit/model/module/target/architecture.rb +27 -37
- data/lib/metasploit/model/module/target/platform.rb +27 -37
- data/lib/metasploit/model/module/type.rb +35 -41
- data/lib/metasploit/model/nilify_blanks.rb +39 -43
- data/lib/metasploit/model/platform.rb +231 -237
- data/lib/metasploit/model/real_pathname.rb +12 -16
- data/lib/metasploit/model/realm.rb +0 -2
- data/lib/metasploit/model/realm/key.rb +0 -2
- data/lib/metasploit/model/reference.rb +102 -108
- data/lib/metasploit/model/search.rb +94 -97
- data/lib/metasploit/model/search/association.rb +163 -169
- data/lib/metasploit/model/search/attribute.rb +131 -139
- data/lib/metasploit/model/search/group.rb +5 -2
- data/lib/metasploit/model/search/operation.rb +32 -29
- data/lib/metasploit/model/search/operation/group.rb +5 -2
- data/lib/metasploit/model/search/operation/value.rb +7 -0
- data/lib/metasploit/model/search/operation/{integer/value.rb → value/integer.rb} +1 -1
- data/lib/metasploit/model/search/operation/{string/value.rb → value/string.rb} +1 -1
- data/lib/metasploit/model/search/operator.rb +65 -65
- data/lib/metasploit/model/search/operator/deprecated.rb +8 -2
- data/lib/metasploit/model/search/operator/group.rb +5 -2
- data/lib/metasploit/model/search/operator/help.rb +71 -79
- data/lib/metasploit/model/search/with.rb +72 -78
- data/lib/metasploit/model/spec.rb +133 -136
- data/lib/metasploit/model/spec/error.rb +3 -9
- data/lib/metasploit/model/spec/i18n_exception_handler.rb +0 -2
- data/lib/metasploit/model/spec/pathname_collision.rb +19 -27
- data/lib/metasploit/model/spec/template/write.rb +0 -2
- data/lib/metasploit/model/spec/temporary_pathname.rb +47 -56
- data/lib/metasploit/model/translation.rb +0 -2
- data/lib/metasploit/model/version.rb +1 -1
- data/lib/metasploit/model/visitation.rb +7 -10
- data/lib/metasploit/model/visitation/visit.rb +79 -85
- data/metasploit-model.gemspec +1 -1
- data/spec/app/models/metasploit/model/search/operation/integer_spec.rb +1 -1
- data/spec/app/models/metasploit/model/search/operation/set/integer_spec.rb +1 -1
- data/spec/app/models/metasploit/model/search/operation/set/string_spec.rb +1 -1
- data/spec/app/models/metasploit/model/search/operation/string_spec.rb +1 -1
- data/spec/dummy/config/application.rb +1 -0
- data/spec/lib/metasploit/model/search/operation/{integer/value_spec.rb → value/integer_spec.rb} +2 -2
- data/spec/lib/metasploit/model/search/operation/{string/value_spec.rb → value/string_spec.rb} +2 -2
- data/spec/support/shared/examples/metasploit/model/search/operation/{integer/value.rb → value/integer.rb} +2 -2
- data/spec/support/shared/examples/metasploit/model/search/operation/{string/value.rb → value/string.rb} +2 -2
- metadata +16 -13
@@ -1,60 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
validates :module_instance,
|
35
|
-
:presence => true
|
36
|
-
validates :name,
|
37
|
-
:presence => true
|
38
|
-
end
|
39
|
-
|
40
|
-
#
|
41
|
-
# Associations
|
42
|
-
#
|
43
|
-
|
44
|
-
# @!attribute [rw] module_instance
|
45
|
-
# Module that has this action.
|
46
|
-
#
|
47
|
-
# @return [Metasploit::Model::Module::Instance]
|
48
|
-
|
49
|
-
#
|
50
|
-
# Attributes
|
51
|
-
#
|
52
|
-
|
53
|
-
# @!attribute [rw] name
|
54
|
-
# The name of this action.
|
55
|
-
#
|
56
|
-
# @return [String]
|
57
|
-
end
|
58
|
-
end
|
1
|
+
# Code shared between `Mdm::Module::Action` and `Metasploit::Framework::Module::Action`.
|
2
|
+
module Metasploit::Model::Module::Action
|
3
|
+
extend ActiveModel::Naming
|
4
|
+
extend ActiveSupport::Concern
|
5
|
+
|
6
|
+
include Metasploit::Model::Translation
|
7
|
+
|
8
|
+
included do
|
9
|
+
include ActiveModel::MassAssignmentSecurity
|
10
|
+
include ActiveModel::Validations
|
11
|
+
include Metasploit::Model::Search
|
12
|
+
|
13
|
+
#
|
14
|
+
# Mass Assignment Security
|
15
|
+
#
|
16
|
+
|
17
|
+
attr_accessible :name
|
18
|
+
|
19
|
+
#
|
20
|
+
# Search Attributes
|
21
|
+
#
|
22
|
+
|
23
|
+
search_attribute :name, :type => :string
|
24
|
+
|
25
|
+
#
|
26
|
+
# Validations
|
27
|
+
#
|
28
|
+
|
29
|
+
validates :module_instance,
|
30
|
+
:presence => true
|
31
|
+
validates :name,
|
32
|
+
:presence => true
|
59
33
|
end
|
34
|
+
|
35
|
+
#
|
36
|
+
# Associations
|
37
|
+
#
|
38
|
+
|
39
|
+
# @!attribute [rw] module_instance
|
40
|
+
# Module that has this action.
|
41
|
+
#
|
42
|
+
# @return [Metasploit::Model::Module::Instance]
|
43
|
+
|
44
|
+
#
|
45
|
+
# Attributes
|
46
|
+
#
|
47
|
+
|
48
|
+
# @!attribute [rw] name
|
49
|
+
# The name of this action.
|
50
|
+
#
|
51
|
+
# @return [String]
|
60
52
|
end
|
@@ -1,500 +1,491 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
}
|
144
|
-
validates :reference_name,
|
145
|
-
:format => {
|
146
|
-
:with => REFERENCE_NAME_REGEXP
|
147
|
-
}
|
148
|
-
end
|
149
|
-
|
150
|
-
# Defines class methods added to classes that include {Metasploit::Model::Module::Ancestor}.
|
151
|
-
module ClassMethods
|
152
|
-
# Returns whether {#handler_type} is required or must be `nil` for the given payload_type.
|
153
|
-
#
|
154
|
-
# @param options [Hash{Symbol => String,nil}]
|
155
|
-
# @option options [String, nil] module_type (nil) `nil` or an element of
|
156
|
-
# `Metasploit::Model::Module::Ancestor::MODULE_TYPES`.
|
157
|
-
# @option options [String, nil] payload_type (nil) `nil` or an element of {PAYLOAD_TYPES}.
|
158
|
-
# @return [true] if {#handler_type} must be present.
|
159
|
-
# @return [false] if {#handler_type} must be `nil`.
|
160
|
-
def handled?(options={})
|
161
|
-
options.assert_valid_keys(:module_type, :payload_type)
|
162
|
-
|
163
|
-
handled = false
|
164
|
-
module_type = options[:module_type]
|
165
|
-
payload_type = options[:payload_type]
|
166
|
-
|
167
|
-
if module_type == 'payload' and HANDLED_TYPES.include? payload_type
|
168
|
-
handled = true
|
169
|
-
end
|
170
|
-
|
171
|
-
handled
|
172
|
-
end
|
173
|
-
end
|
1
|
+
# Code shared between `Mdm::Module::Ancestor` and `Metasploit::Framework::Module::Ancestor`.
|
2
|
+
module Metasploit::Model::Module::Ancestor
|
3
|
+
extend ActiveModel::Naming
|
4
|
+
extend ActiveSupport::Autoload
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
include Metasploit::Model::Translation
|
8
|
+
|
9
|
+
autoload :Spec
|
10
|
+
|
11
|
+
#
|
12
|
+
# CONSTANTS
|
13
|
+
#
|
14
|
+
|
15
|
+
# The directory for a given {#module_type} is a not always the pluralization of #module_type, so this maps the
|
16
|
+
# #module_type to the type directory that is used to generate the #real_path from the #module_type and
|
17
|
+
# #reference_name.
|
18
|
+
DIRECTORY_BY_MODULE_TYPE = {
|
19
|
+
Metasploit::Model::Module::Type::AUX => Metasploit::Model::Module::Type::AUX,
|
20
|
+
Metasploit::Model::Module::Type::ENCODER => Metasploit::Model::Module::Type::ENCODER.pluralize,
|
21
|
+
Metasploit::Model::Module::Type::EXPLOIT => Metasploit::Model::Module::Type::EXPLOIT.pluralize,
|
22
|
+
Metasploit::Model::Module::Type::NOP => Metasploit::Model::Module::Type::NOP.pluralize,
|
23
|
+
Metasploit::Model::Module::Type::PAYLOAD => Metasploit::Model::Module::Type::PAYLOAD.pluralize,
|
24
|
+
Metasploit::Model::Module::Type::POST => Metasploit::Model::Module::Type::POST
|
25
|
+
}
|
26
|
+
|
27
|
+
# File extension used for metasploit modules.
|
28
|
+
EXTENSION = '.rb'
|
29
|
+
|
30
|
+
# The {#payload_type payload types} that require {#handler_type}.
|
31
|
+
HANDLED_TYPES = [
|
32
|
+
'single',
|
33
|
+
'stager'
|
34
|
+
]
|
35
|
+
|
36
|
+
# Maps directory to {#module_type} for converting a {#real_path} into a {#module_type} and {#reference_name}
|
37
|
+
MODULE_TYPE_BY_DIRECTORY = DIRECTORY_BY_MODULE_TYPE.invert
|
38
|
+
|
39
|
+
# Valid values for {#payload_type} if {#payload?} is `true`.
|
40
|
+
PAYLOAD_TYPES = [
|
41
|
+
'single',
|
42
|
+
'stage',
|
43
|
+
'stager'
|
44
|
+
]
|
45
|
+
|
46
|
+
# Regexp to keep '\' out of reference names
|
47
|
+
REFERENCE_NAME_REGEXP = /\A[\-0-9A-Z_a-z]+(?:\/[\-0-9A-Z_a-z]+)*\Z/
|
48
|
+
|
49
|
+
# Separator used to join names in {#reference_name}. It is always '/', even on Windows, where '\' is a valid
|
50
|
+
# file separator.
|
51
|
+
REFERENCE_NAME_SEPARATOR = '/'
|
52
|
+
|
53
|
+
# Regular expression matching a full SHA-1 hex digest.
|
54
|
+
SHA1_HEX_DIGEST_REGEXP = /\A[0-9a-z]{40}\Z/
|
55
|
+
|
56
|
+
included do
|
57
|
+
include ActiveModel::MassAssignmentSecurity
|
58
|
+
include ActiveModel::Validations
|
59
|
+
include ActiveModel::Validations::Callbacks
|
60
|
+
include Metasploit::Model::Derivation
|
61
|
+
include Metasploit::Model::Derivation::FullName
|
62
|
+
include Metasploit::Model::RealPathname
|
63
|
+
|
64
|
+
#
|
65
|
+
# Derivations
|
66
|
+
#
|
67
|
+
|
68
|
+
#
|
69
|
+
# Module Cache Construction derivation of {#module_type} and {#reference_name} from {#real_path} and
|
70
|
+
# {Metasploit::Model::Module::Path#real_path}.
|
71
|
+
#
|
72
|
+
|
73
|
+
derives :module_type, :validate => false
|
74
|
+
derives :reference_name, :validate => false
|
75
|
+
|
76
|
+
#
|
77
|
+
# Normal derivation from setting {#module_type} and {#reference_name}
|
78
|
+
#
|
79
|
+
|
80
|
+
derives :full_name, :validate => true
|
81
|
+
derives :payload_type, :validate => true
|
82
|
+
derives :real_path, :validate => true
|
83
|
+
|
84
|
+
# Don't validate attributes that require accessing file system to derive value
|
85
|
+
derives :real_path_modified_at, :validate => false
|
86
|
+
derives :real_path_sha1_hex_digest, :validate => false
|
87
|
+
|
88
|
+
#
|
89
|
+
# Mass Assignment Security
|
90
|
+
#
|
91
|
+
|
92
|
+
# full_name is NOT accessible since it's derived and must match {#derived_full_name} so there's no reason for a
|
93
|
+
# user to set it.
|
94
|
+
# handler_type is accessible because it's needed to derive {Metasploit::Model::Module::Class#reference_name}.
|
95
|
+
attr_accessible :handler_type
|
96
|
+
# module_type is accessible because it's needed to derive {#full_name} and {#real_path}.
|
97
|
+
attr_accessible :module_type
|
98
|
+
# payload_type is NOT accessible since it's derived and must match {#derived_payload_type}.
|
99
|
+
# reference_name is accessible because it's needed to derive {#full_name} and {#real_path}.
|
100
|
+
attr_accessible :reference_name
|
101
|
+
# real_path is accessible since {#module_type} and {#reference_name} can be derived from real_path.
|
102
|
+
attr_accessible :real_path
|
103
|
+
# real_path_modified_at is NOT accessible since it's derived
|
104
|
+
# real_path_sha1_hex_digest is NOT accessible since it's derived
|
105
|
+
|
106
|
+
#
|
107
|
+
# Validations
|
108
|
+
#
|
109
|
+
|
110
|
+
validates :handler_type,
|
111
|
+
:unless => :loading_context?,
|
112
|
+
:nil => {
|
113
|
+
:unless => :handled?
|
114
|
+
},
|
115
|
+
:presence => {
|
116
|
+
:if => :handled?
|
117
|
+
}
|
118
|
+
validates :module_type,
|
119
|
+
:inclusion => {
|
120
|
+
:in => Metasploit::Model::Module::Type::ALL
|
121
|
+
}
|
122
|
+
validates :parent_path,
|
123
|
+
:presence => true
|
124
|
+
validates :payload_type,
|
125
|
+
:inclusion => {
|
126
|
+
:if => :payload?,
|
127
|
+
:in => PAYLOAD_TYPES
|
128
|
+
},
|
129
|
+
:nil => {
|
130
|
+
:unless => :payload?
|
131
|
+
}
|
132
|
+
validates :real_path_modified_at,
|
133
|
+
:presence => true
|
134
|
+
validates :real_path_sha1_hex_digest,
|
135
|
+
:format => {
|
136
|
+
:with => SHA1_HEX_DIGEST_REGEXP
|
137
|
+
}
|
138
|
+
validates :reference_name,
|
139
|
+
:format => {
|
140
|
+
:with => REFERENCE_NAME_REGEXP
|
141
|
+
}
|
142
|
+
end
|
174
143
|
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
# appended to the end of the single's or stage's {#reference_name} to get the
|
196
|
-
# {Metasploit::Model::Module::Class#reference_name}.
|
197
|
-
#
|
198
|
-
# @return [String] if {Metasploit::Model::Module::Ancestor#handled?} is `true`.
|
199
|
-
# @return [nil] if {Metasploit::Model::Module::Ancestor#handled?} is `false`.
|
200
|
-
|
201
|
-
# @!attribute [rw] module_type
|
202
|
-
# The type of the module. This would be called #type, but #type is reserved for ActiveRecord's single table
|
203
|
-
# inheritance.
|
204
|
-
#
|
205
|
-
# @return [String] key in {Metasploit::Model::Module::Ancestor::DIRECTORY_BY_MODULE_TYPE}.
|
206
|
-
|
207
|
-
# @!attribute [rw] payload_type
|
208
|
-
# For payload modules, the type of payload, either 'single', 'stage', or 'stager'.
|
209
|
-
#
|
210
|
-
# @return ['single', 'stage', 'stager'] if `Metasploit::Model::Module::Ancestor#payload?` is `true`.
|
211
|
-
# @return [nil] if `Metasploit::Model::Module::Ancestor#payload?` is `false`
|
212
|
-
# @see Metasploit::Model::Module::Ancestor::PAYLOAD_TYPES
|
213
|
-
|
214
|
-
# @!attribute [rw] real_path
|
215
|
-
# The real (absolute) path to module file on-disk.
|
216
|
-
#
|
217
|
-
# @return [String]
|
218
|
-
|
219
|
-
# @!attribute [rw] real_path_modified_at
|
220
|
-
# The modification time of the module {#real_path file on-disk}.
|
221
|
-
#
|
222
|
-
# @return [DateTime]
|
223
|
-
|
224
|
-
# @!attribute [rw] real_path_sha1_hex_digest
|
225
|
-
# The SHA1 hexadecimal digest of contents of the file at {#real_path}. Stored as a string because postgres does not
|
226
|
-
# have support for a 160 bit numerical type and the hexdigest format is more recognizable when using SQL directly.
|
227
|
-
#
|
228
|
-
# @see Digest::SHA1#hexdigest
|
229
|
-
# @return [String]
|
230
|
-
|
231
|
-
# @!attribute [rw] reference_name
|
232
|
-
# The reference name of the module. The name of the module under its {#module_type type}.
|
233
|
-
#
|
234
|
-
# @return [String]
|
235
|
-
|
236
|
-
#
|
237
|
-
# Instance Methods
|
238
|
-
#
|
239
|
-
|
240
|
-
# The contents of {#real_path}.
|
241
|
-
#
|
242
|
-
# @return [String] contents of file at {#real_path}.
|
243
|
-
# @return [nil] if {#real_path} is `nil`.
|
244
|
-
# @return [nil] if {#real_path} does not exist on-disk.
|
245
|
-
def contents
|
246
|
-
contents = nil
|
247
|
-
|
248
|
-
if real_path
|
249
|
-
# rescue around both File calls since file could be deleted before size or after size and before read
|
250
|
-
begin
|
251
|
-
size = File.size(real_path)
|
252
|
-
# Specify full size of file for faster read on Windows (less chance of context switching mid-read).
|
253
|
-
# Open in binary mode in Windows to handle non-text content embedded in file.
|
254
|
-
contents = File.read(real_path, size, 0, mode: 'rb')
|
255
|
-
rescue Errno::ENOENT
|
256
|
-
contents = nil
|
257
|
-
end
|
258
|
-
end
|
144
|
+
# Defines class methods added to classes that include {Metasploit::Model::Module::Ancestor}.
|
145
|
+
module ClassMethods
|
146
|
+
# Returns whether {#handler_type} is required or must be `nil` for the given payload_type.
|
147
|
+
#
|
148
|
+
# @param options [Hash{Symbol => String,nil}]
|
149
|
+
# @option options [String, nil] module_type (nil) `nil` or an element of
|
150
|
+
# `Metasploit::Model::Module::Ancestor::MODULE_TYPES`.
|
151
|
+
# @option options [String, nil] payload_type (nil) `nil` or an element of {PAYLOAD_TYPES}.
|
152
|
+
# @return [true] if {#handler_type} must be present.
|
153
|
+
# @return [false] if {#handler_type} must be `nil`.
|
154
|
+
def handled?(options={})
|
155
|
+
options.assert_valid_keys(:module_type, :payload_type)
|
156
|
+
|
157
|
+
handled = false
|
158
|
+
module_type = options[:module_type]
|
159
|
+
payload_type = options[:payload_type]
|
160
|
+
|
161
|
+
if module_type == 'payload' and HANDLED_TYPES.include? payload_type
|
162
|
+
handled = true
|
163
|
+
end
|
259
164
|
|
260
|
-
|
261
|
-
|
165
|
+
handled
|
166
|
+
end
|
167
|
+
end
|
262
168
|
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
169
|
+
#
|
170
|
+
# Associations
|
171
|
+
#
|
172
|
+
|
173
|
+
# @!attribute [rw] parent_path
|
174
|
+
# Path under which this ancestor exists on-disk.
|
175
|
+
#
|
176
|
+
# @return [Metasploit::Model::Module::Path]
|
177
|
+
|
178
|
+
#
|
179
|
+
# Attributes
|
180
|
+
#
|
181
|
+
|
182
|
+
# @!attribute [rw] full_name
|
183
|
+
# The full name of the module. The full name is `"#{module_type}/#{reference_name}"`.
|
184
|
+
#
|
185
|
+
# @return [String]
|
186
|
+
|
187
|
+
# @!attribute [rw] handler_type
|
188
|
+
# The handler type (in the case of singles) or (in the case of stagers) the handler type alias. Handler type is
|
189
|
+
# appended to the end of the single's or stage's {#reference_name} to get the
|
190
|
+
# {Metasploit::Model::Module::Class#reference_name}.
|
191
|
+
#
|
192
|
+
# @return [String] if {Metasploit::Model::Module::Ancestor#handled?} is `true`.
|
193
|
+
# @return [nil] if {Metasploit::Model::Module::Ancestor#handled?} is `false`.
|
194
|
+
|
195
|
+
# @!attribute [rw] module_type
|
196
|
+
# The type of the module. This would be called #type, but #type is reserved for ActiveRecord's single table
|
197
|
+
# inheritance.
|
198
|
+
#
|
199
|
+
# @return [String] key in {Metasploit::Model::Module::Ancestor::DIRECTORY_BY_MODULE_TYPE}.
|
200
|
+
|
201
|
+
# @!attribute [rw] payload_type
|
202
|
+
# For payload modules, the type of payload, either 'single', 'stage', or 'stager'.
|
203
|
+
#
|
204
|
+
# @return ['single', 'stage', 'stager'] if `Metasploit::Model::Module::Ancestor#payload?` is `true`.
|
205
|
+
# @return [nil] if `Metasploit::Model::Module::Ancestor#payload?` is `false`
|
206
|
+
# @see Metasploit::Model::Module::Ancestor::PAYLOAD_TYPES
|
207
|
+
|
208
|
+
# @!attribute [rw] real_path
|
209
|
+
# The real (absolute) path to module file on-disk.
|
210
|
+
#
|
211
|
+
# @return [String]
|
212
|
+
|
213
|
+
# @!attribute [rw] real_path_modified_at
|
214
|
+
# The modification time of the module {#real_path file on-disk}.
|
215
|
+
#
|
216
|
+
# @return [DateTime]
|
217
|
+
|
218
|
+
# @!attribute [rw] real_path_sha1_hex_digest
|
219
|
+
# The SHA1 hexadecimal digest of contents of the file at {#real_path}. Stored as a string because postgres does not
|
220
|
+
# have support for a 160 bit numerical type and the hexdigest format is more recognizable when using SQL directly.
|
221
|
+
#
|
222
|
+
# @see Digest::SHA1#hexdigest
|
223
|
+
# @return [String]
|
224
|
+
|
225
|
+
# @!attribute [rw] reference_name
|
226
|
+
# The reference name of the module. The name of the module under its {#module_type type}.
|
227
|
+
#
|
228
|
+
# @return [String]
|
229
|
+
|
230
|
+
#
|
231
|
+
# Instance Methods
|
232
|
+
#
|
233
|
+
|
234
|
+
# The contents of {#real_path}.
|
235
|
+
#
|
236
|
+
# @return [String] contents of file at {#real_path}.
|
237
|
+
# @return [nil] if {#real_path} is `nil`.
|
238
|
+
# @return [nil] if {#real_path} does not exist on-disk.
|
239
|
+
def contents
|
240
|
+
contents = nil
|
241
|
+
|
242
|
+
if real_path
|
243
|
+
# rescue around both File calls since file could be deleted before size or after size and before read
|
244
|
+
begin
|
245
|
+
size = File.size(real_path)
|
246
|
+
# Specify full size of file for faster read on Windows (less chance of context switching mid-read).
|
247
|
+
# Open in binary mode in Windows to handle non-text content embedded in file.
|
248
|
+
contents = File.read(real_path, size, 0, mode: 'rb')
|
249
|
+
rescue Errno::ENOENT
|
250
|
+
contents = nil
|
251
|
+
end
|
252
|
+
end
|
271
253
|
|
272
|
-
|
273
|
-
|
254
|
+
contents
|
255
|
+
end
|
274
256
|
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
257
|
+
# Derives {#module_type} from {#real_path} and {Metasploit::Model::Module::Path#real_path}.
|
258
|
+
#
|
259
|
+
# @return [String]
|
260
|
+
# @return [nil] if {#real_path} is `nil`
|
261
|
+
# @return [nil] if {#relative_file_names} does not start with a module type directory.
|
262
|
+
def derived_module_type
|
263
|
+
module_type_directory = relative_file_names.first
|
264
|
+
derived = MODULE_TYPE_BY_DIRECTORY[module_type_directory]
|
282
265
|
|
283
|
-
|
284
|
-
|
285
|
-
end
|
266
|
+
derived
|
267
|
+
end
|
286
268
|
|
287
|
-
|
288
|
-
|
269
|
+
# Derives {#payload_type} from {#reference_name}.
|
270
|
+
#
|
271
|
+
# @return [String]
|
272
|
+
# @return [nil] if {#payload_type_directory} is `nil`
|
273
|
+
def derived_payload_type
|
274
|
+
derived = nil
|
275
|
+
directory = payload_type_directory
|
289
276
|
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
#
|
294
|
-
# @return [String] the real path to the file holding the ruby Module or ruby Class represented by this ancestor.
|
295
|
-
# @return [nil] if {#parent_path} is `nil`.
|
296
|
-
# @return [nil] if {Metasploit::Model::Module::Path#real_path parent_path.real_path} is `nil`.
|
297
|
-
# @return [nil] if {#module_type_directory} is `nil`.
|
298
|
-
# @return [nil] if {#reference_name} is `nil`.
|
299
|
-
def derived_real_path
|
300
|
-
derived_real_path = nil
|
301
|
-
|
302
|
-
if parent_path and parent_path.real_path and module_type_directory and reference_path
|
303
|
-
derived_real_path = File.join(
|
304
|
-
parent_path.real_path,
|
305
|
-
module_type_directory,
|
306
|
-
reference_path
|
307
|
-
)
|
308
|
-
end
|
277
|
+
if directory
|
278
|
+
derived = directory.singularize
|
279
|
+
end
|
309
280
|
|
310
|
-
|
311
|
-
|
281
|
+
derived
|
282
|
+
end
|
312
283
|
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
321
|
-
|
322
|
-
|
323
|
-
|
324
|
-
|
325
|
-
|
326
|
-
|
327
|
-
|
328
|
-
|
284
|
+
# Derives {#real_path} by combining {Metasploit::Model::Module::Path#real_path parent_path.real_path},
|
285
|
+
# {#module_type_directory}, and {#reference_path} in the same way the module loader does in
|
286
|
+
# metasploit-framework.
|
287
|
+
#
|
288
|
+
# @return [String] the real path to the file holding the ruby Module or ruby Class represented by this ancestor.
|
289
|
+
# @return [nil] if {#parent_path} is `nil`.
|
290
|
+
# @return [nil] if {Metasploit::Model::Module::Path#real_path parent_path.real_path} is `nil`.
|
291
|
+
# @return [nil] if {#module_type_directory} is `nil`.
|
292
|
+
# @return [nil] if {#reference_name} is `nil`.
|
293
|
+
def derived_real_path
|
294
|
+
derived_real_path = nil
|
295
|
+
|
296
|
+
if parent_path and parent_path.real_path and module_type_directory and reference_path
|
297
|
+
derived_real_path = File.join(
|
298
|
+
parent_path.real_path,
|
299
|
+
module_type_directory,
|
300
|
+
reference_path
|
301
|
+
)
|
302
|
+
end
|
329
303
|
|
330
|
-
|
331
|
-
|
332
|
-
# @return [String] 40 character SHA1 hex digest if {#real_path} can be read.
|
333
|
-
# @return [nil] if {#real_path} cannot be read.
|
334
|
-
def derived_real_path_sha1_hex_digest
|
335
|
-
begin
|
336
|
-
sha1 = Digest::SHA1.file(real_path.to_s)
|
337
|
-
rescue Errno::ENOENT
|
338
|
-
hex_digest = nil
|
339
|
-
else
|
340
|
-
hex_digest = sha1.hexdigest
|
341
|
-
end
|
304
|
+
derived_real_path
|
305
|
+
end
|
342
306
|
|
343
|
-
|
344
|
-
|
307
|
+
# Derives {#real_path_modified_at} by getting the modification time of the file on-disk.
|
308
|
+
#
|
309
|
+
# @return [Time] modification time of {#real_path} if {#real_path} exists on disk and modification time can be
|
310
|
+
# queried by user.
|
311
|
+
# @return [nil] if {#real_path} does not exist or user cannot query the file's modification time.
|
312
|
+
def derived_real_path_modified_at
|
313
|
+
real_path_string = real_path.to_s
|
314
|
+
|
315
|
+
begin
|
316
|
+
mtime = File.mtime(real_path_string)
|
317
|
+
rescue Errno::ENOENT
|
318
|
+
nil
|
319
|
+
else
|
320
|
+
mtime.utc
|
321
|
+
end
|
322
|
+
end
|
345
323
|
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
derived = reference_name_file_names.join(REFERENCE_NAME_SEPARATOR)
|
359
|
-
end
|
360
|
-
end
|
324
|
+
# Derives {#real_path_sha1_hex_digest} by running the contents of {#real_path} through Digest::SHA1.hexdigest.
|
325
|
+
#
|
326
|
+
# @return [String] 40 character SHA1 hex digest if {#real_path} can be read.
|
327
|
+
# @return [nil] if {#real_path} cannot be read.
|
328
|
+
def derived_real_path_sha1_hex_digest
|
329
|
+
begin
|
330
|
+
sha1 = Digest::SHA1.file(real_path.to_s)
|
331
|
+
rescue Errno::ENOENT
|
332
|
+
hex_digest = nil
|
333
|
+
else
|
334
|
+
hex_digest = sha1.hexdigest
|
335
|
+
end
|
361
336
|
|
362
|
-
|
363
|
-
|
337
|
+
hex_digest
|
338
|
+
end
|
364
339
|
|
365
|
-
|
366
|
-
|
367
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
374
|
-
|
340
|
+
# Derives {#reference_name} from {#real_path} and {Metasploit::Model::Module::Path#real_path}.
|
341
|
+
#
|
342
|
+
# @return [String]
|
343
|
+
# @return [nil] if {#real_path} is `nil`.
|
344
|
+
def derived_reference_name
|
345
|
+
derived = nil
|
346
|
+
reference_name_file_names = relative_file_names.drop(1)
|
347
|
+
reference_name_base_name = reference_name_file_names[-1]
|
348
|
+
|
349
|
+
if reference_name_base_name
|
350
|
+
if File.extname(reference_name_base_name) == EXTENSION
|
351
|
+
reference_name_file_names[-1] = File.basename(reference_name_base_name, EXTENSION)
|
352
|
+
derived = reference_name_file_names.join(REFERENCE_NAME_SEPARATOR)
|
353
|
+
end
|
354
|
+
end
|
375
355
|
|
376
|
-
|
377
|
-
|
378
|
-
# @return [String]
|
379
|
-
# @see Metasploit::Model::Module::Ancestor::DIRECTORY_BY_MODULE_TYPE
|
380
|
-
def module_type_directory
|
381
|
-
Metasploit::Model::Module::Ancestor::DIRECTORY_BY_MODULE_TYPE[module_type]
|
382
|
-
end
|
356
|
+
derived
|
357
|
+
end
|
383
358
|
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
end
|
359
|
+
# Returns whether {#handler_type} is required or must be `nil`.
|
360
|
+
#
|
361
|
+
# @return (see handled?)
|
362
|
+
# @see handled?
|
363
|
+
def handled?
|
364
|
+
self.class.handled?(
|
365
|
+
:module_type => module_type,
|
366
|
+
:payload_type => payload_type
|
367
|
+
)
|
368
|
+
end
|
395
369
|
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
payload_name = nil
|
404
|
-
|
405
|
-
if module_type == Metasploit::Model::Module::Type::PAYLOAD
|
406
|
-
case payload_type
|
407
|
-
when 'single', 'stage'
|
408
|
-
if reference_name && payload_type_directory
|
409
|
-
escaped_payload_type_directory = Regexp.escape(payload_type_directory)
|
410
|
-
payload_type_directory_regexp = /^#{escaped_payload_type_directory}\//
|
411
|
-
payload_name = reference_name.gsub(payload_type_directory_regexp, '')
|
412
|
-
end
|
413
|
-
when 'stager'
|
414
|
-
payload_name = handler_type
|
415
|
-
end
|
416
|
-
end
|
370
|
+
# The directory for {#module_type} under {Metasploit::Model::Module::Path parent_path.real_path}.
|
371
|
+
#
|
372
|
+
# @return [String]
|
373
|
+
# @see Metasploit::Model::Module::Ancestor::DIRECTORY_BY_MODULE_TYPE
|
374
|
+
def module_type_directory
|
375
|
+
Metasploit::Model::Module::Ancestor::DIRECTORY_BY_MODULE_TYPE[module_type]
|
376
|
+
end
|
417
377
|
|
418
|
-
|
419
|
-
|
378
|
+
# Return whether this forms part of a payload (either a single, stage, or stager).
|
379
|
+
#
|
380
|
+
# @return [true] if {#module_type} == 'payload'
|
381
|
+
# @return [false] if {#module_type} != 'payload'
|
382
|
+
def payload?
|
383
|
+
if module_type == Metasploit::Model::Module::Type::PAYLOAD
|
384
|
+
true
|
385
|
+
else
|
386
|
+
false
|
387
|
+
end
|
388
|
+
end
|
420
389
|
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
|
430
|
-
|
431
|
-
|
390
|
+
# The name used to forming the {Metasploit::Model::Module::Class#reference_name} for payloads.
|
391
|
+
#
|
392
|
+
# @return [String] The {#reference_name} without the {#payload_type_directory} if {#payload_type} is `'single'`
|
393
|
+
# or `'stage'`
|
394
|
+
# @return [String] The {#handler_type} if {#payload_type} is `'stager'`
|
395
|
+
# @return [nil] if {#module_type} is not `'payload'`
|
396
|
+
def payload_name
|
397
|
+
payload_name = nil
|
398
|
+
|
399
|
+
if module_type == Metasploit::Model::Module::Type::PAYLOAD
|
400
|
+
case payload_type
|
401
|
+
when 'single', 'stage'
|
402
|
+
if reference_name && payload_type_directory
|
403
|
+
escaped_payload_type_directory = Regexp.escape(payload_type_directory)
|
404
|
+
payload_type_directory_regexp = /^#{escaped_payload_type_directory}\//
|
405
|
+
payload_name = reference_name.gsub(payload_type_directory_regexp, '')
|
432
406
|
end
|
407
|
+
when 'stager'
|
408
|
+
payload_name = handler_type
|
409
|
+
end
|
410
|
+
end
|
433
411
|
|
434
|
-
|
435
|
-
|
412
|
+
payload_name
|
413
|
+
end
|
436
414
|
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
|
441
|
-
|
442
|
-
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
end
|
415
|
+
# The directory for {#payload_type} under {#module_type_directory} in {#real_path}.
|
416
|
+
#
|
417
|
+
# @return [String] first directory in reference_name
|
418
|
+
# @return [nil] if {#payload?} is `false`.
|
419
|
+
# @return [nil] if {#reference_name} is `nil`.
|
420
|
+
def payload_type_directory
|
421
|
+
directory = nil
|
422
|
+
|
423
|
+
if payload? and reference_name
|
424
|
+
head, _tail = reference_name.split(REFERENCE_NAME_SEPARATOR, 2)
|
425
|
+
directory = head
|
426
|
+
end
|
450
427
|
|
451
|
-
|
452
|
-
|
453
|
-
# @return [Pathname]
|
454
|
-
def relative_pathname
|
455
|
-
relative_pathname = nil
|
456
|
-
real_pathname = self.real_pathname
|
428
|
+
directory
|
429
|
+
end
|
457
430
|
|
458
|
-
|
459
|
-
|
431
|
+
# File names on {#relative_pathname}.
|
432
|
+
#
|
433
|
+
# @return [Enumerator<String>]
|
434
|
+
def relative_file_names
|
435
|
+
relative_pathname = self.relative_pathname
|
436
|
+
|
437
|
+
if relative_pathname
|
438
|
+
relative_pathname.each_filename
|
439
|
+
else
|
440
|
+
# empty enumerator
|
441
|
+
Enumerator.new { }
|
442
|
+
end
|
443
|
+
end
|
460
444
|
|
461
|
-
|
462
|
-
|
445
|
+
# {#real_path} relative to {Metasploit::Model::Module::Path#real_path}
|
446
|
+
#
|
447
|
+
# @return [Pathname]
|
448
|
+
def relative_pathname
|
449
|
+
relative_pathname = nil
|
450
|
+
real_pathname = self.real_pathname
|
463
451
|
|
464
|
-
|
465
|
-
|
466
|
-
end
|
467
|
-
end
|
468
|
-
end
|
452
|
+
if real_pathname
|
453
|
+
parent_path = self.parent_path
|
469
454
|
|
470
|
-
|
455
|
+
if parent_path
|
456
|
+
parent_path_real_pathname = parent_path.real_pathname
|
457
|
+
|
458
|
+
if parent_path_real_pathname
|
459
|
+
relative_pathname = real_pathname.relative_path_from parent_path_real_pathname
|
471
460
|
end
|
461
|
+
end
|
462
|
+
end
|
472
463
|
|
473
|
-
|
474
|
-
|
475
|
-
#
|
476
|
-
# @return [String] {#reference_name} + {EXTENSION}
|
477
|
-
# @return [nil] if {#reference_name} is `nil`.
|
478
|
-
def reference_path
|
479
|
-
path = nil
|
464
|
+
relative_pathname
|
465
|
+
end
|
480
466
|
|
481
|
-
|
482
|
-
|
483
|
-
|
467
|
+
# The path relative to the {#module_type_directory} under the {Metasploit::Model::Module::Path
|
468
|
+
# parent_path.real_path}, including the file {EXTENSION extension}.
|
469
|
+
#
|
470
|
+
# @return [String] {#reference_name} + {EXTENSION}
|
471
|
+
# @return [nil] if {#reference_name} is `nil`.
|
472
|
+
def reference_path
|
473
|
+
path = nil
|
484
474
|
|
485
|
-
|
486
|
-
|
475
|
+
if reference_name
|
476
|
+
path = "#{reference_name}#{EXTENSION}"
|
477
|
+
end
|
478
|
+
|
479
|
+
path
|
480
|
+
end
|
487
481
|
|
488
|
-
|
482
|
+
private
|
489
483
|
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
end
|
497
|
-
end
|
498
|
-
end
|
484
|
+
# Whether this ancestor is being validated for loading.
|
485
|
+
#
|
486
|
+
# @return [true] if `#validation_context` is `:loading`
|
487
|
+
# @return [false] otherwise
|
488
|
+
def loading_context?
|
489
|
+
validation_context == :loading
|
499
490
|
end
|
500
|
-
end
|
491
|
+
end
|