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,25 +1,19 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
# @return [nil] if reference_name is `nil`.
|
13
|
-
def derived_full_name
|
14
|
-
derived = nil
|
1
|
+
# Methods for deriving full_name from module_type and reference_name in `Mdm::Module::Ancestor`,
|
2
|
+
# `Mdm::Module::Class`, `Metasploit::Framework::Module::Ancestor`, and `Metasploit::Framework::Module::Class`.
|
3
|
+
module Metasploit::Model::Derivation::FullName
|
4
|
+
# Derives full_name by combining module_type and reference_name in the same way used to create modules using
|
5
|
+
# Msf::ModuleManager#create in metasploit-framework.
|
6
|
+
#
|
7
|
+
# @return [String] <module_type>/<reference_name>
|
8
|
+
# @return [nil] if module_type is `nil`.
|
9
|
+
# @return [nil] if reference_name is `nil`.
|
10
|
+
def derived_full_name
|
11
|
+
derived = nil
|
15
12
|
|
16
|
-
|
17
|
-
|
18
|
-
end
|
19
|
-
|
20
|
-
derived
|
21
|
-
end
|
22
|
-
end
|
13
|
+
if module_type and reference_name
|
14
|
+
derived = "#{module_type}/#{reference_name}"
|
23
15
|
end
|
16
|
+
|
17
|
+
derived
|
24
18
|
end
|
25
|
-
end
|
19
|
+
end
|
@@ -1,130 +1,124 @@
|
|
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
|
-
# @return [String]
|
109
|
-
def derived_full
|
110
|
-
if domain.present? && local.present?
|
111
|
-
"#{local}@#{domain}"
|
112
|
-
end
|
113
|
-
end
|
114
|
-
|
115
|
-
# Derives {#local} from {#full}.
|
116
|
-
#
|
117
|
-
# @return [String] if {#full} is present
|
118
|
-
# @return [nil] if {#full} is not present
|
119
|
-
def derived_local
|
120
|
-
local = nil
|
121
|
-
|
122
|
-
if full.present?
|
123
|
-
local, _domain = full.split('@', 2)
|
124
|
-
end
|
125
|
-
|
126
|
-
local
|
127
|
-
end
|
1
|
+
# Code shared between `Mdm::EmailAddress` and `Metasploit::Framework::EmailAddress`.
|
2
|
+
module Metasploit::Model::EmailAddress
|
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::Derivation
|
12
|
+
include Metasploit::Model::Search
|
13
|
+
|
14
|
+
#
|
15
|
+
# Derivations
|
16
|
+
#
|
17
|
+
|
18
|
+
derives :domain, :validate => true
|
19
|
+
derives :full, :validate => true
|
20
|
+
derives :local, :validate => true
|
21
|
+
|
22
|
+
#
|
23
|
+
# Mass Assignment Security
|
24
|
+
#
|
25
|
+
|
26
|
+
attr_accessible :domain
|
27
|
+
attr_accessible :full
|
28
|
+
attr_accessible :local
|
29
|
+
|
30
|
+
#
|
31
|
+
# Search Attributes
|
32
|
+
#
|
33
|
+
|
34
|
+
search_attribute :domain, :type => :string
|
35
|
+
search_attribute :full, :type => :string
|
36
|
+
search_attribute :local, :type => :string
|
37
|
+
|
38
|
+
#
|
39
|
+
# Validations
|
40
|
+
#
|
41
|
+
|
42
|
+
validates :domain, :presence => true
|
43
|
+
validates :local, :presence => true
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# Associations
|
48
|
+
#
|
49
|
+
|
50
|
+
# @!attribute [rw] module_authors
|
51
|
+
# Credits where {#authors} used this email address for {#module_instances modules}.
|
52
|
+
#
|
53
|
+
# @return [Array<Metasploit::Model::Module::Author>]
|
54
|
+
|
55
|
+
# @!attribute [r] authors
|
56
|
+
# Authors that used this email address.
|
57
|
+
#
|
58
|
+
# @return [Array<Metasploit::Model::Author>]
|
59
|
+
|
60
|
+
# @!attribute [r] module_instances
|
61
|
+
# Modules where this email address was used.
|
62
|
+
#
|
63
|
+
# @return [Array<Metasploit::Module::Instance>]
|
64
|
+
|
65
|
+
#
|
66
|
+
# Attributes
|
67
|
+
#
|
68
|
+
|
69
|
+
# @!attribute [rw] domain
|
70
|
+
# The domain part of the email address after the `'@'`.
|
71
|
+
#
|
72
|
+
# @return [String]
|
73
|
+
|
74
|
+
# @!attribute [rw] full
|
75
|
+
# The full email address.
|
76
|
+
#
|
77
|
+
# @return [String] <{#local}>@<{#domain}
|
78
|
+
|
79
|
+
# @!attribute [rw] local
|
80
|
+
# The local part of the email address before the `'@'`.
|
81
|
+
#
|
82
|
+
# @return [String]
|
83
|
+
|
84
|
+
#
|
85
|
+
# Methods
|
86
|
+
#
|
87
|
+
|
88
|
+
# Derives {#domain} from {#full}
|
89
|
+
#
|
90
|
+
# @return [String] if {#full} is present
|
91
|
+
# @return [nil] if {#full} is not present
|
92
|
+
def derived_domain
|
93
|
+
domain = nil
|
94
|
+
|
95
|
+
if full.present?
|
96
|
+
_local, domain = full.split('@', 2)
|
97
|
+
end
|
98
|
+
|
99
|
+
domain
|
100
|
+
end
|
101
|
+
|
102
|
+
# Derives {#full} from {#domain} and {#local}
|
103
|
+
#
|
104
|
+
# @return [String]
|
105
|
+
def derived_full
|
106
|
+
if domain.present? && local.present?
|
107
|
+
"#{local}@#{domain}"
|
128
108
|
end
|
129
109
|
end
|
130
|
-
|
110
|
+
|
111
|
+
# Derives {#local} from {#full}.
|
112
|
+
#
|
113
|
+
# @return [String] if {#full} is present
|
114
|
+
# @return [nil] if {#full} is not present
|
115
|
+
def derived_local
|
116
|
+
local = nil
|
117
|
+
|
118
|
+
if full.present?
|
119
|
+
local, _domain = full.split('@', 2)
|
120
|
+
end
|
121
|
+
|
122
|
+
local
|
123
|
+
end
|
124
|
+
end
|
@@ -1,28 +1,33 @@
|
|
1
1
|
require 'rails'
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
3
|
+
# Rails engine for Metasploit::Model. Will automatically be used if `Rails` is defined when
|
4
|
+
# 'metasploit/model' is required, as should be the case in any normal Rails application Gemfile where
|
5
|
+
# gem 'rails' is the first gem in the Gemfile.
|
6
|
+
class Metasploit::Model::Engine < Rails::Engine
|
7
|
+
# @see http://viget.com/extend/rails-engine-testing-with-rspec-capybara-and-factorygirl
|
8
|
+
config.generators do |g|
|
9
|
+
g.assets false
|
10
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories'
|
11
|
+
g.helper false
|
12
|
+
g.test_framework :rspec, :fixture => false
|
13
|
+
end
|
14
|
+
|
15
|
+
# Remove ActiveSupport::Dependencies loading paths to save time during constant resolution and to ensure that
|
16
|
+
# metasploit-model is properly declaring all autoloads and not falling back on ActiveSupport::Dependencies
|
17
|
+
config.paths.each_value do |path|
|
18
|
+
path.skip_autoload!
|
19
|
+
path.skip_autoload_once!
|
20
|
+
path.skip_eager_load!
|
21
|
+
path.skip_load_path!
|
22
|
+
end
|
16
23
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
24
|
+
initializer 'metasploit-model.prepend_factory_path', :after => 'factory_girl.set_factory_paths' do
|
25
|
+
if defined? FactoryGirl
|
26
|
+
relative_definition_file_path = config.generators.options[:factory_girl][:dir]
|
27
|
+
definition_file_path = root.join(relative_definition_file_path)
|
21
28
|
|
22
|
-
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|
29
|
+
# unshift so that dependent gems can modify metasploit-model's factories
|
30
|
+
FactoryGirl.definition_file_paths.unshift definition_file_path
|
26
31
|
end
|
27
32
|
end
|
28
33
|
end
|
@@ -1,19 +1,13 @@
|
|
1
|
-
|
1
|
+
# Error raised if a {Metasploit::Model} ActiveModel is invalid.
|
2
|
+
class Metasploit::Model::Invalid < Metasploit::Model::Error
|
3
|
+
def initialize(model)
|
4
|
+
@model = model
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(model)
|
8
|
-
@model = model
|
9
|
-
|
10
|
-
errors = @model.errors.full_messages.join(', ')
|
11
|
-
# Must be called model_invalid so it doesn't alias errors.messages.invalid
|
12
|
-
translated_message = ::I18n.translate('metasploit.model.errors.messages.model_invalid', :errors => errors)
|
13
|
-
super(translated_message)
|
14
|
-
end
|
15
|
-
|
16
|
-
attr_reader :model
|
17
|
-
end
|
6
|
+
errors = @model.errors.full_messages.join(', ')
|
7
|
+
# Must be called model_invalid so it doesn't alias errors.messages.invalid
|
8
|
+
translated_message = ::I18n.translate('metasploit.model.errors.messages.model_invalid', :errors => errors)
|
9
|
+
super(translated_message)
|
18
10
|
end
|
19
|
-
|
11
|
+
|
12
|
+
attr_reader :model
|
13
|
+
end
|
@@ -1,24 +1,20 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
module Module
|
6
|
-
extend ActiveSupport::Autoload
|
1
|
+
# Namespace that maps to `Mdm::Module` and `Metasploit::Framework::Module` and contains constants and mixins to
|
2
|
+
# DRY the implementation of the in-memory and in-database models in those namespaces.
|
3
|
+
module Metasploit::Model::Module
|
4
|
+
extend ActiveSupport::Autoload
|
7
5
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
6
|
+
autoload :Action
|
7
|
+
autoload :Ancestor
|
8
|
+
autoload :Architecture
|
9
|
+
autoload :Author
|
10
|
+
autoload :Class
|
11
|
+
autoload :Handler
|
12
|
+
autoload :Instance
|
13
|
+
autoload :Path
|
14
|
+
autoload :Platform
|
15
|
+
autoload :Rank
|
16
|
+
autoload :Reference
|
17
|
+
autoload :Stance
|
18
|
+
autoload :Target
|
19
|
+
autoload :Type
|
20
|
+
end
|