metasploit-model 0.28.0-java → 0.29.0-java
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/config/locales/en.yml +0 -171
- data/lib/metasploit/model.rb +0 -2
- data/lib/metasploit/model/spec.rb +0 -130
- data/lib/metasploit/model/version.rb +1 -1
- data/spec/support/shared/examples/metasploit/model/search/operator/help.rb +4 -6
- data/spec/support/shared/examples/metasploit/model/translation.rb +1 -1
- data/spec/support/shared/examples/search_association.rb +1 -1
- data/spec/support/shared/examples/search_with.rb +4 -2
- metadata +2 -348
- data/app/models/metasploit/model/module/ancestor/spec/template.rb +0 -125
- data/app/models/metasploit/model/module/class/spec/template.rb +0 -92
- data/app/models/metasploit/model/module/instance/spec/template.rb +0 -97
- data/app/models/metasploit/model/spec/template.rb +0 -277
- data/app/validators/derivation_validator.rb +0 -17
- data/app/validators/dynamic_length_validator.rb +0 -45
- data/lib/metasploit/model/architecture.rb +0 -342
- data/lib/metasploit/model/author.rb +0 -54
- data/lib/metasploit/model/authority.rb +0 -141
- data/lib/metasploit/model/authority/bid.rb +0 -10
- data/lib/metasploit/model/authority/cve.rb +0 -10
- data/lib/metasploit/model/authority/msb.rb +0 -10
- data/lib/metasploit/model/authority/osvdb.rb +0 -10
- data/lib/metasploit/model/authority/pmasa.rb +0 -10
- data/lib/metasploit/model/authority/secunia.rb +0 -10
- data/lib/metasploit/model/authority/us_cert_vu.rb +0 -10
- data/lib/metasploit/model/authority/waraxe.rb +0 -31
- data/lib/metasploit/model/authority/zdi.rb +0 -10
- data/lib/metasploit/model/derivation.rb +0 -109
- data/lib/metasploit/model/derivation/full_name.rb +0 -19
- data/lib/metasploit/model/email_address.rb +0 -124
- data/lib/metasploit/model/module.rb +0 -20
- data/lib/metasploit/model/module/action.rb +0 -52
- data/lib/metasploit/model/module/ancestor.rb +0 -491
- data/lib/metasploit/model/module/ancestor/spec.rb +0 -6
- data/lib/metasploit/model/module/architecture.rb +0 -34
- data/lib/metasploit/model/module/author.rb +0 -40
- data/lib/metasploit/model/module/class.rb +0 -403
- data/lib/metasploit/model/module/class/spec.rb +0 -6
- data/lib/metasploit/model/module/handler.rb +0 -29
- data/lib/metasploit/model/module/instance.rb +0 -622
- data/lib/metasploit/model/module/instance/spec.rb +0 -6
- data/lib/metasploit/model/module/path.rb +0 -159
- data/lib/metasploit/model/module/platform.rb +0 -32
- data/lib/metasploit/model/module/rank.rb +0 -85
- data/lib/metasploit/model/module/reference.rb +0 -32
- data/lib/metasploit/model/module/stance.rb +0 -16
- data/lib/metasploit/model/module/target.rb +0 -78
- data/lib/metasploit/model/module/target/architecture.rb +0 -34
- data/lib/metasploit/model/module/target/platform.rb +0 -34
- data/lib/metasploit/model/module/type.rb +0 -38
- data/lib/metasploit/model/platform.rb +0 -246
- data/lib/metasploit/model/real_pathname.rb +0 -16
- data/lib/metasploit/model/reference.rb +0 -104
- data/spec/app/models/metasploit/model/module/ancestor/spec/template_spec.rb +0 -174
- data/spec/app/models/metasploit/model/module/class/spec/template_spec.rb +0 -222
- data/spec/app/models/metasploit/model/module/instance/spec/template_spec.rb +0 -201
- data/spec/app/models/metasploit/model/search/operator/deprecated/app_spec.rb +0 -62
- data/spec/app/models/metasploit/model/search/operator/deprecated/author_spec.rb +0 -197
- data/spec/app/models/metasploit/model/search/operator/deprecated/authority_spec.rb +0 -135
- data/spec/app/models/metasploit/model/search/operator/deprecated/platform_spec.rb +0 -124
- data/spec/app/models/metasploit/model/search/operator/deprecated/ref_spec.rb +0 -387
- data/spec/app/models/metasploit/model/search/operator/deprecated/text_spec.rb +0 -399
- data/spec/app/models/metasploit/model/spec/template_spec.rb +0 -23
- data/spec/app/validators/derivation_validator_spec.rb +0 -92
- data/spec/app/validators/dynamic_length_validator_spec.rb +0 -293
- data/spec/dummy/app/models/dummy/architecture.rb +0 -92
- data/spec/dummy/app/models/dummy/author.rb +0 -15
- data/spec/dummy/app/models/dummy/authority.rb +0 -130
- data/spec/dummy/app/models/dummy/email_address.rb +0 -27
- data/spec/dummy/app/models/dummy/module/action.rb +0 -25
- data/spec/dummy/app/models/dummy/module/ancestor.rb +0 -67
- data/spec/dummy/app/models/dummy/module/architecture.rb +0 -19
- data/spec/dummy/app/models/dummy/module/author.rb +0 -28
- data/spec/dummy/app/models/dummy/module/class.rb +0 -69
- data/spec/dummy/app/models/dummy/module/instance.rb +0 -209
- data/spec/dummy/app/models/dummy/module/path.rb +0 -64
- data/spec/dummy/app/models/dummy/module/platform.rb +0 -19
- data/spec/dummy/app/models/dummy/module/rank.rb +0 -44
- data/spec/dummy/app/models/dummy/module/reference.rb +0 -19
- data/spec/dummy/app/models/dummy/module/target.rb +0 -62
- data/spec/dummy/app/models/dummy/module/target/architecture.rb +0 -19
- data/spec/dummy/app/models/dummy/module/target/platform.rb +0 -19
- data/spec/dummy/app/models/dummy/platform.rb +0 -58
- data/spec/dummy/app/models/dummy/reference.rb +0 -31
- data/spec/dummy/spec/factories/dummy/architectures.rb +0 -13
- data/spec/dummy/spec/factories/dummy/authorities.rb +0 -32
- data/spec/dummy/spec/factories/dummy/authors.rb +0 -8
- data/spec/dummy/spec/factories/dummy/email_addresses.rb +0 -8
- data/spec/dummy/spec/factories/dummy/module/actions.rb +0 -13
- data/spec/dummy/spec/factories/dummy/module/ancestors.rb +0 -45
- data/spec/dummy/spec/factories/dummy/module/architectures.rb +0 -35
- data/spec/dummy/spec/factories/dummy/module/authors.rb +0 -10
- data/spec/dummy/spec/factories/dummy/module/classes.rb +0 -40
- data/spec/dummy/spec/factories/dummy/module/instances.rb +0 -86
- data/spec/dummy/spec/factories/dummy/module/paths.rb +0 -16
- data/spec/dummy/spec/factories/dummy/module/platforms.rb +0 -35
- data/spec/dummy/spec/factories/dummy/module/ranks.rb +0 -14
- data/spec/dummy/spec/factories/dummy/module/references.rb +0 -17
- data/spec/dummy/spec/factories/dummy/module/target/architectures.rb +0 -40
- data/spec/dummy/spec/factories/dummy/module/target/platforms.rb +0 -41
- data/spec/dummy/spec/factories/dummy/module/targets.rb +0 -46
- data/spec/dummy/spec/factories/dummy/platforms.rb +0 -3
- data/spec/dummy/spec/factories/dummy/references.rb +0 -26
- data/spec/factories/metasploit/model/architectures.rb +0 -6
- data/spec/factories/metasploit/model/authorities.rb +0 -28
- data/spec/factories/metasploit/model/authors.rb +0 -9
- data/spec/factories/metasploit/model/email_addresses.rb +0 -14
- data/spec/factories/metasploit/model/module/actions.rb +0 -9
- data/spec/factories/metasploit/model/module/ancestors.rb +0 -180
- data/spec/factories/metasploit/model/module/architectures.rb +0 -15
- data/spec/factories/metasploit/model/module/classes.rb +0 -47
- data/spec/factories/metasploit/model/module/handlers.rb +0 -3
- data/spec/factories/metasploit/model/module/instances.rb +0 -83
- data/spec/factories/metasploit/model/module/paths.rb +0 -51
- data/spec/factories/metasploit/model/module/platforms.rb +0 -15
- data/spec/factories/metasploit/model/module/ranks.rb +0 -9
- data/spec/factories/metasploit/model/module/references.rb +0 -11
- data/spec/factories/metasploit/model/module/stances.rb +0 -3
- data/spec/factories/metasploit/model/module/targets.rb +0 -22
- data/spec/factories/metasploit/model/module/types.rb +0 -5
- data/spec/factories/metasploit/model/references.rb +0 -88
- data/spec/lib/metasploit/model/architecture_spec.rb +0 -52
- data/spec/lib/metasploit/model/author_spec.rb +0 -6
- data/spec/lib/metasploit/model/authority/bid_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/cve_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/msb_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/osvdb_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/pmasa_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/secunia_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/us_cert_vu_spec.rb +0 -17
- data/spec/lib/metasploit/model/authority/waraxe_spec.rb +0 -51
- data/spec/lib/metasploit/model/authority/zdi_spec.rb +0 -21
- data/spec/lib/metasploit/model/authority_spec.rb +0 -10
- data/spec/lib/metasploit/model/derivation/full_name_spec.rb +0 -75
- data/spec/lib/metasploit/model/derivation_spec.rb +0 -217
- data/spec/lib/metasploit/model/email_address_spec.rb +0 -19
- data/spec/lib/metasploit/model/module/action_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/ancestor_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/architecture_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/author_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/class_spec.rb +0 -19
- data/spec/lib/metasploit/model/module/handler_spec.rb +0 -61
- data/spec/lib/metasploit/model/module/instance_spec.rb +0 -183
- data/spec/lib/metasploit/model/module/path_spec.rb +0 -6
- data/spec/lib/metasploit/model/module/platform_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/rank_spec.rb +0 -29
- data/spec/lib/metasploit/model/module/reference_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/stance_spec.rb +0 -30
- data/spec/lib/metasploit/model/module/target/architecture_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/target/platform_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/target_spec.rb +0 -9
- data/spec/lib/metasploit/model/module/type_spec.rb +0 -125
- data/spec/lib/metasploit/model/platform_spec.rb +0 -100
- data/spec/lib/metasploit/model/reference_spec.rb +0 -21
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/contents/metasploit_module.rb +0 -12
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents.rb +0 -10
- data/spec/support/shared/contexts/metasploit/model/module/ancestor/factory/contents/metasploit_module.rb +0 -15
- data/spec/support/shared/examples/derives.rb +0 -115
- data/spec/support/shared/examples/metasploit/model/architecture.rb +0 -425
- data/spec/support/shared/examples/metasploit/model/architecture/seed.rb +0 -25
- data/spec/support/shared/examples/metasploit/model/author.rb +0 -27
- data/spec/support/shared/examples/metasploit/model/authority.rb +0 -124
- data/spec/support/shared/examples/metasploit/model/authority/seed.rb +0 -49
- data/spec/support/shared/examples/metasploit/model/email_address.rb +0 -220
- data/spec/support/shared/examples/metasploit/model/module/action.rb +0 -26
- data/spec/support/shared/examples/metasploit/model/module/ancestor.rb +0 -2004
- data/spec/support/shared/examples/metasploit/model/module/ancestor/payload_factory.rb +0 -63
- data/spec/support/shared/examples/metasploit/model/module/architecture.rb +0 -36
- data/spec/support/shared/examples/metasploit/model/module/author.rb +0 -29
- data/spec/support/shared/examples/metasploit/model/module/class.rb +0 -1514
- data/spec/support/shared/examples/metasploit/model/module/handler.rb +0 -21
- data/spec/support/shared/examples/metasploit/model/module/instance.rb +0 -1384
- data/spec/support/shared/examples/metasploit/model/module/instance/class_methods.rb +0 -537
- data/spec/support/shared/examples/metasploit/model/module/instance/is_not_stanced_with_module_type.rb +0 -22
- data/spec/support/shared/examples/metasploit/model/module/instance/is_stanced_with_module_type.rb +0 -38
- data/spec/support/shared/examples/metasploit/model/module/instance/validates/dynamic_length_of.rb +0 -131
- data/spec/support/shared/examples/metasploit/model/module/path.rb +0 -493
- data/spec/support/shared/examples/metasploit/model/module/platform.rb +0 -36
- data/spec/support/shared/examples/metasploit/model/module/rank.rb +0 -92
- data/spec/support/shared/examples/metasploit/model/module/reference.rb +0 -16
- data/spec/support/shared/examples/metasploit/model/module/target.rb +0 -29
- data/spec/support/shared/examples/metasploit/model/module/target/architecture.rb +0 -56
- data/spec/support/shared/examples/metasploit/model/module/target/platform.rb +0 -56
- data/spec/support/shared/examples/metasploit/model/platform.rb +0 -213
- data/spec/support/shared/examples/metasploit/model/real_pathname.rb +0 -29
- data/spec/support/shared/examples/metasploit/model/reference.rb +0 -410
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/app.rb +0 -44
- data/spec/support/shared/examples/search/query/metasploit/model/search/operator/deprecated/authority.rb +0 -72
- data/spec/support/templates/metasploit/model/module/ancestors/_attributes.rb.erb +0 -9
- data/spec/support/templates/metasploit/model/module/ancestors/_methods.rb.erb +0 -8
- data/spec/support/templates/metasploit/model/module/ancestors/_validations.rb.erb +0 -6
- data/spec/support/templates/metasploit/model/module/ancestors/base.rb.erb +0 -3
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_auxiliary.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_encoder.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_exploit.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_non_payload.rb.erb +0 -5
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_nop.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_payload.rb.erb +0 -4
- data/spec/support/templates/metasploit/model/module/ancestors/module_types/_post.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_handled.rb.erb +0 -20
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_single.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stage.rb.erb +0 -0
- data/spec/support/templates/metasploit/model/module/ancestors/payload_types/_stager.rb.erb +0 -1
- data/spec/support/templates/metasploit/model/module/classes/_methods.rb.erb +0 -9
@@ -1,17 +0,0 @@
|
|
1
|
-
# Validator for {Metasploit::Model::Derivation::ClassMethods#derives}.
|
2
|
-
class DerivationValidator < ActiveModel::EachValidator
|
3
|
-
# Validates that `attribute`'s `value` equals derived_<attribute>'s value. If they are not equal then the error
|
4
|
-
# message is `'must match its derivation'`.
|
5
|
-
#
|
6
|
-
# @param record [#errors, ActiveRecord::Base] ActiveModel or ActiveRecord
|
7
|
-
# @param attribute [Symbol] name of derived attribute.
|
8
|
-
# @param value [Object] value of `attribute` in `record`.
|
9
|
-
# @return [void]
|
10
|
-
def validate_each(record, attribute, value)
|
11
|
-
derived_value = record.send("derived_#{attribute}")
|
12
|
-
|
13
|
-
if value != derived_value
|
14
|
-
record.errors[attribute] << 'must match its derivation'
|
15
|
-
end
|
16
|
-
end
|
17
|
-
end
|
@@ -1,45 +0,0 @@
|
|
1
|
-
# Validates that `value` of `attribute` on `record` is meets the
|
2
|
-
# `record.dynamic_length_validation_options(attribute)`.
|
3
|
-
#
|
4
|
-
# Works similar to `LengthValidator`, but the minimum and maximum lengths are controlled dynamically by the `record` to
|
5
|
-
# allow the validation to vary based on some other attribute in the record.
|
6
|
-
class DynamicLengthValidator < ActiveModel::EachValidator
|
7
|
-
# Validates that value's `#length` meets the minimum and maximum options in
|
8
|
-
# `record.dynamic_length_validation_options(attribute)`.
|
9
|
-
#
|
10
|
-
# @param record [Object, #dynamic_length_validation_options] record that supports dynmaic length options on
|
11
|
-
# `attribute`.
|
12
|
-
# @param attribute [Symbol] name of an attribute on `record` with the given `value`.
|
13
|
-
# @param value [Object, #length] value of `attribute`.
|
14
|
-
# @return [void]
|
15
|
-
def validate_each(record, attribute, value)
|
16
|
-
# dynamic_options are not checked for validity the way options would be for LengthValidator because
|
17
|
-
# dynamic_length_validation_options can be {} in some cases.
|
18
|
-
dynamic_options = record.dynamic_length_validation_options(attribute)
|
19
|
-
value_length = value.length
|
20
|
-
|
21
|
-
ActiveModel::Validations::LengthValidator::CHECKS.each do |key, validity_check|
|
22
|
-
check_value = dynamic_options[key]
|
23
|
-
|
24
|
-
if check_value
|
25
|
-
unless value_length.send(validity_check, check_value)
|
26
|
-
errors_options = dynamic_options.except(*ActiveModel::Validations::LengthValidator::RESERVED_OPTIONS)
|
27
|
-
errors_options[:count] = check_value
|
28
|
-
|
29
|
-
message = errors_options[:message]
|
30
|
-
message_key = ActiveModel::Validations::LengthValidator::MESSAGES[key]
|
31
|
-
|
32
|
-
unless message
|
33
|
-
default_message = dynamic_options[message_key]
|
34
|
-
|
35
|
-
if default_message
|
36
|
-
errors_options[:message] = default_message
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|
40
|
-
record.errors.add(attribute, message_key, errors_options)
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
end
|
@@ -1,342 +0,0 @@
|
|
1
|
-
# Code shared between `Mdm::Architecture` and `Metasploit::Framework::Architecture`.
|
2
|
-
module Metasploit::Model::Architecture
|
3
|
-
extend ActiveModel::Naming
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
include Metasploit::Model::Translation
|
7
|
-
|
8
|
-
#
|
9
|
-
# CONSTANTS
|
10
|
-
#
|
11
|
-
|
12
|
-
# Valid values for {#abbreviation}
|
13
|
-
ABBREVIATIONS = [
|
14
|
-
'armbe',
|
15
|
-
'armle',
|
16
|
-
'cbea',
|
17
|
-
'cbea64',
|
18
|
-
'cmd',
|
19
|
-
'dalvik',
|
20
|
-
'firefox',
|
21
|
-
'java',
|
22
|
-
'mipsbe',
|
23
|
-
'mipsle',
|
24
|
-
'nodejs',
|
25
|
-
'php',
|
26
|
-
'ppc',
|
27
|
-
'ppc64',
|
28
|
-
'python',
|
29
|
-
'ruby',
|
30
|
-
'sparc',
|
31
|
-
'tty',
|
32
|
-
'x86',
|
33
|
-
'x86_64'
|
34
|
-
]
|
35
|
-
# Valid values for {#bits}.
|
36
|
-
BITS = [
|
37
|
-
32,
|
38
|
-
64
|
39
|
-
]
|
40
|
-
# Valid values for {#endianness}.
|
41
|
-
ENDIANNESSES = [
|
42
|
-
'big',
|
43
|
-
'little'
|
44
|
-
]
|
45
|
-
# Valid values for {#family}.
|
46
|
-
FAMILIES = [
|
47
|
-
'arm',
|
48
|
-
'cbea',
|
49
|
-
'javascript',
|
50
|
-
'mips',
|
51
|
-
'ppc',
|
52
|
-
'sparc',
|
53
|
-
'x86'
|
54
|
-
]
|
55
|
-
# Attributes for seeds. Ensures that in-database seeds for `Mdm::Architecture` and in-memory seeds for
|
56
|
-
# `Metasploit::Framework::Architecture` are the same.
|
57
|
-
SEED_ATTRIBUTES = [
|
58
|
-
{
|
59
|
-
:abbreviation => 'armbe',
|
60
|
-
:bits => 32,
|
61
|
-
:endianness => 'big',
|
62
|
-
:family => 'arm',
|
63
|
-
:summary => 'Little-endian ARM'
|
64
|
-
},
|
65
|
-
{
|
66
|
-
:abbreviation => 'armle',
|
67
|
-
:bits => 32,
|
68
|
-
:endianness => 'little',
|
69
|
-
:family => 'arm',
|
70
|
-
:summary => 'Big-endian ARM'
|
71
|
-
},
|
72
|
-
{
|
73
|
-
:abbreviation => 'cbea',
|
74
|
-
:bits => 32,
|
75
|
-
:endianness => 'big',
|
76
|
-
:family => 'cbea',
|
77
|
-
:summary => '32-bit Cell Broadband Engine Architecture'
|
78
|
-
},
|
79
|
-
{
|
80
|
-
:abbreviation => 'cbea64',
|
81
|
-
:bits => 64,
|
82
|
-
:endianness => 'big',
|
83
|
-
:family => 'cbea',
|
84
|
-
:summary => '64-bit Cell Broadband Engine Architecture'
|
85
|
-
},
|
86
|
-
{
|
87
|
-
:abbreviation => 'cmd',
|
88
|
-
:bits => nil,
|
89
|
-
:endianness => nil,
|
90
|
-
:family => nil,
|
91
|
-
:summary => 'Command Injection'
|
92
|
-
},
|
93
|
-
{
|
94
|
-
:abbreviation => 'dalvik',
|
95
|
-
:bits => nil,
|
96
|
-
:endianness => nil,
|
97
|
-
:family => nil,
|
98
|
-
:summary => 'Dalvik process virtual machine used in Google Android'
|
99
|
-
},
|
100
|
-
{
|
101
|
-
abbreviation: 'firefox',
|
102
|
-
bits: nil,
|
103
|
-
endianness: nil,
|
104
|
-
family: 'javascript',
|
105
|
-
summary: "Firefox's privileged javascript API"
|
106
|
-
},
|
107
|
-
{
|
108
|
-
:abbreviation => 'java',
|
109
|
-
:bits => nil,
|
110
|
-
:endianness => 'big',
|
111
|
-
:family => nil,
|
112
|
-
:summary => 'Java'
|
113
|
-
},
|
114
|
-
{
|
115
|
-
:abbreviation => 'mipsbe',
|
116
|
-
:bits => 32,
|
117
|
-
:endianness => 'big',
|
118
|
-
:family => 'mips',
|
119
|
-
:summary => 'Big-endian MIPS'
|
120
|
-
},
|
121
|
-
{
|
122
|
-
:abbreviation => 'mipsle',
|
123
|
-
:bits => 32,
|
124
|
-
:endianness => 'little',
|
125
|
-
:family => 'mips',
|
126
|
-
:summary => 'Little-endian MIPS'
|
127
|
-
},
|
128
|
-
{
|
129
|
-
abbreviation: 'nodejs',
|
130
|
-
bits: nil,
|
131
|
-
endianness: nil,
|
132
|
-
family: 'javascript',
|
133
|
-
summary: 'NodeJS'
|
134
|
-
},
|
135
|
-
{
|
136
|
-
:abbreviation => 'php',
|
137
|
-
:bits => nil,
|
138
|
-
:endianness => nil,
|
139
|
-
:family => nil,
|
140
|
-
:summary => 'PHP'
|
141
|
-
},
|
142
|
-
{
|
143
|
-
:abbreviation => 'ppc',
|
144
|
-
:bits => 32,
|
145
|
-
:endianness => 'big',
|
146
|
-
:family => 'ppc',
|
147
|
-
:summary => '32-bit Peformance Optimization With Enhanced RISC - Performance Computing'
|
148
|
-
},
|
149
|
-
{
|
150
|
-
:abbreviation => 'ppc64',
|
151
|
-
:bits => 64,
|
152
|
-
:endianness => 'big',
|
153
|
-
:family => 'ppc',
|
154
|
-
:summary => '64-bit Performance Optimization With Enhanced RISC - Performance Computing'
|
155
|
-
},
|
156
|
-
{
|
157
|
-
:abbreviation => 'python',
|
158
|
-
:bits => nil,
|
159
|
-
:endianness => nil,
|
160
|
-
:family => nil,
|
161
|
-
:summary => 'Python'
|
162
|
-
},
|
163
|
-
{
|
164
|
-
:abbreviation => 'ruby',
|
165
|
-
:bits => nil,
|
166
|
-
:endianness => nil,
|
167
|
-
:family => nil,
|
168
|
-
:summary => 'Ruby'
|
169
|
-
},
|
170
|
-
{
|
171
|
-
:abbreviation => 'sparc',
|
172
|
-
:bits => nil,
|
173
|
-
:endianness => nil,
|
174
|
-
:family => 'sparc',
|
175
|
-
:summary => 'Scalable Processor ARChitecture'
|
176
|
-
},
|
177
|
-
{
|
178
|
-
:abbreviation => 'tty',
|
179
|
-
:bits => nil,
|
180
|
-
:endianness => nil,
|
181
|
-
:family => nil,
|
182
|
-
:summary => '*nix terminal'
|
183
|
-
},
|
184
|
-
{
|
185
|
-
:abbreviation => 'x86',
|
186
|
-
:bits => 32,
|
187
|
-
:endianness => 'little',
|
188
|
-
:family => 'x86',
|
189
|
-
:summary => '32-bit x86'
|
190
|
-
},
|
191
|
-
{
|
192
|
-
:abbreviation => 'x86_64',
|
193
|
-
:bits => 64,
|
194
|
-
:endianness => 'little',
|
195
|
-
:family => 'x86',
|
196
|
-
:summary => '64-bit x86'
|
197
|
-
}
|
198
|
-
]
|
199
|
-
|
200
|
-
included do
|
201
|
-
include ActiveModel::Validations
|
202
|
-
include Metasploit::Model::Search
|
203
|
-
|
204
|
-
#
|
205
|
-
# Search Attributes
|
206
|
-
#
|
207
|
-
|
208
|
-
search_attribute :abbreviation,
|
209
|
-
type: {
|
210
|
-
set: :string
|
211
|
-
}
|
212
|
-
search_attribute :bits,
|
213
|
-
type: {
|
214
|
-
set: :integer
|
215
|
-
}
|
216
|
-
search_attribute :endianness,
|
217
|
-
type: {
|
218
|
-
set: :string
|
219
|
-
}
|
220
|
-
search_attribute :family,
|
221
|
-
type: {
|
222
|
-
set: :string
|
223
|
-
}
|
224
|
-
|
225
|
-
#
|
226
|
-
# Validations
|
227
|
-
#
|
228
|
-
|
229
|
-
validates :abbreviation,
|
230
|
-
:inclusion => {
|
231
|
-
:in => ABBREVIATIONS
|
232
|
-
}
|
233
|
-
validates :bits,
|
234
|
-
:inclusion => {
|
235
|
-
:allow_nil => true,
|
236
|
-
:in => BITS
|
237
|
-
}
|
238
|
-
validates :endianness,
|
239
|
-
:inclusion => {
|
240
|
-
:allow_nil => true,
|
241
|
-
:in => ENDIANNESSES
|
242
|
-
}
|
243
|
-
validates :family,
|
244
|
-
:inclusion => {
|
245
|
-
:allow_nil => true,
|
246
|
-
:in => FAMILIES
|
247
|
-
}
|
248
|
-
validates :summary,
|
249
|
-
:presence => true
|
250
|
-
end
|
251
|
-
|
252
|
-
# Adds <attribute>_set methods to class.
|
253
|
-
module ClassMethods
|
254
|
-
# Set of valid values to search for `attribute`. Does not include `nil` as search syntax cannot differentiate
|
255
|
-
# '' and nil when parsing.
|
256
|
-
#
|
257
|
-
# @param attribute [Symbol] attribute name.
|
258
|
-
# @return [Set]
|
259
|
-
def self.set(attribute)
|
260
|
-
SEED_ATTRIBUTES.each_with_object(Set.new) { |attributes, set|
|
261
|
-
value = attributes.fetch(attribute)
|
262
|
-
|
263
|
-
unless value.nil?
|
264
|
-
set.add value
|
265
|
-
end
|
266
|
-
}
|
267
|
-
end
|
268
|
-
|
269
|
-
# @!method abbreviation_set
|
270
|
-
# Set of valid {Metasploit::Model::Architecture#abbreviation} for search.
|
271
|
-
#
|
272
|
-
# @return [Set<String>]
|
273
|
-
#
|
274
|
-
# @!method bits_set
|
275
|
-
# Set of valid {Metasploit::Model::Architecture#bits} for search.
|
276
|
-
#
|
277
|
-
# @return [Set<Integer>]
|
278
|
-
#
|
279
|
-
# @!method endianness_set
|
280
|
-
# Set of valid {Metasploit::Model::Architecture#endianness} for search.
|
281
|
-
#
|
282
|
-
# @return [Set<String>]
|
283
|
-
#
|
284
|
-
# @!method family_set
|
285
|
-
# Set of valid {Metasploit::Model::Architecture#family} for search.
|
286
|
-
#
|
287
|
-
# @return [Set<String>]
|
288
|
-
[:abbreviation, :bits, :endianness, :family].each do |attribute|
|
289
|
-
# calculate external to method so it is only calculated once
|
290
|
-
set = self.set(attribute)
|
291
|
-
|
292
|
-
define_method("#{attribute}_set") do
|
293
|
-
set
|
294
|
-
end
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
#
|
299
|
-
# Associations
|
300
|
-
#
|
301
|
-
|
302
|
-
# @!attribute [r] module_instances
|
303
|
-
# {Metasploit::Model::Module::Instance Modules} that have this {Metasploit::Model::Module::Architecture} as a
|
304
|
-
# {Metasploit::Model::Module::Instance#architectures support architecture}.
|
305
|
-
#
|
306
|
-
# @return [Array<Metasploit::Model::Module::Instance>]
|
307
|
-
|
308
|
-
#
|
309
|
-
# Attributes
|
310
|
-
#
|
311
|
-
|
312
|
-
# @!attribute [rw] abbreviation
|
313
|
-
# Abbreviation used for the architecture. Will match ARCH constants in metasploit-framework.
|
314
|
-
#
|
315
|
-
# @return [String]
|
316
|
-
|
317
|
-
# @!attribute [rw] bits
|
318
|
-
# Number of bits supported by this architecture.
|
319
|
-
#
|
320
|
-
# @return [32] if 32-bit
|
321
|
-
# @return [64] if 64-bit
|
322
|
-
# @return [nil] if bits aren't applicable, such as for non-CPU architectures like ruby, etc.
|
323
|
-
|
324
|
-
# @!attribute [rw] endianness
|
325
|
-
# The endianness of the architecture.
|
326
|
-
#
|
327
|
-
# @return ['big'] if big endian
|
328
|
-
# @return ['little'] if little endian
|
329
|
-
# @return [nil] if endianness is not applicable, such as for software architectures like tty.
|
330
|
-
|
331
|
-
# @!attribute [rw] family
|
332
|
-
# The CPU architecture family.
|
333
|
-
#
|
334
|
-
# @return [String] if a CPU architecture.
|
335
|
-
# @return [nil] if not a CPU architecture.
|
336
|
-
|
337
|
-
# @!attribute [rw] summary
|
338
|
-
# Sentence length summary of architecture. Usually an expansion of the abbreviation or initialism in the
|
339
|
-
# {#abbreviation} and the {#bits} and {#endianness} in prose.
|
340
|
-
#
|
341
|
-
# @return [String]
|
342
|
-
end
|
@@ -1,54 +0,0 @@
|
|
1
|
-
# Code shared between `Mdm::Author` and `Metasploit::Framework::Author`.
|
2
|
-
module Metasploit::Model::Author
|
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 :name, :presence => true
|
30
|
-
end
|
31
|
-
|
32
|
-
#
|
33
|
-
# Associations
|
34
|
-
#
|
35
|
-
|
36
|
-
# @!attribute [r] email_addresses
|
37
|
-
# Email addresses used by this author across all {#module_instances}.
|
38
|
-
#
|
39
|
-
# @return [Array<Metasploit::Model::EmailAddress>]
|
40
|
-
|
41
|
-
# @!attribute [r] module_instances
|
42
|
-
# Modules written by this author.
|
43
|
-
#
|
44
|
-
# @return [Array<Metasploit::Model::Module::Instance>]
|
45
|
-
|
46
|
-
#
|
47
|
-
# Attributes
|
48
|
-
#
|
49
|
-
|
50
|
-
# @!attribute [rw] name
|
51
|
-
# Full name (First + Last name) or handle of author.
|
52
|
-
#
|
53
|
-
# @return [String]
|
54
|
-
end
|