metasploit_data_models 0.24.4 → 0.24.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +3 -3
- data/.travis.yml +3 -6
- data/CONTRIBUTING.md +52 -10
- data/Gemfile +8 -1
- data/Rakefile +0 -23
- data/app/models/mdm/api_key.rb +1 -41
- data/app/models/mdm/client.rb +1 -41
- data/app/models/mdm/cred.rb +19 -107
- data/app/models/mdm/event.rb +1 -48
- data/app/models/mdm/exploit_attempt.rb +16 -65
- data/app/models/mdm/exploited_host.rb +1 -28
- data/app/models/mdm/host_detail.rb +1 -45
- data/app/models/mdm/host_tag.rb +8 -6
- data/app/models/mdm/listener.rb +1 -53
- data/app/models/mdm/macro.rb +0 -42
- data/app/models/mdm/mod_ref.rb +0 -21
- data/app/models/mdm/module/action.rb +0 -15
- data/app/models/mdm/module/arch.rb +0 -10
- data/app/models/mdm/module/author.rb +0 -16
- data/app/models/mdm/module/mixin.rb +0 -13
- data/app/models/mdm/module/platform.rb +0 -11
- data/app/models/mdm/module/target.rb +0 -18
- data/app/models/mdm/nexpose_console.rb +4 -82
- data/app/models/mdm/profile.rb +0 -36
- data/app/models/mdm/route.rb +5 -17
- data/app/models/mdm/session_event.rb +1 -33
- data/app/models/mdm/tag.rb +10 -49
- data/app/models/mdm/task.rb +45 -94
- data/app/models/mdm/task_cred.rb +0 -29
- data/app/models/mdm/task_host.rb +0 -25
- data/app/models/mdm/task_service.rb +0 -25
- data/app/models/mdm/task_session.rb +0 -25
- data/app/models/mdm/user.rb +6 -188
- data/app/models/mdm/vuln_attempt.rb +12 -37
- data/app/models/mdm/vuln_detail.rb +5 -139
- data/app/models/mdm/vuln_ref.rb +1 -4
- data/app/models/mdm/web_form.rb +1 -35
- data/app/models/mdm/web_page.rb +1 -70
- data/app/models/mdm/web_site.rb +1 -51
- data/app/models/mdm/wmap_request.rb +0 -85
- data/app/models/mdm/wmap_target.rb +0 -40
- data/app/models/mdm/workspace.rb +14 -152
- data/app/models/metasploit_data_models/automatic_exploitation.rb +16 -0
- data/app/models/metasploit_data_models/automatic_exploitation/match.rb +24 -19
- data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +5 -33
- data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +4 -22
- data/app/models/metasploit_data_models/automatic_exploitation/run.rb +3 -13
- data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
- data/app/models/metasploit_data_models/module_run.rb +1 -1
- data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
- data/app/validators/ip_format_validator.rb +0 -4
- data/app/validators/parameters_validator.rb +0 -12
- data/app/validators/password_is_strong_validator.rb +1 -10
- data/lib/mdm/host/operating_system_normalization.rb +10 -7
- data/lib/metasploit_data_models.rb +0 -4
- data/lib/metasploit_data_models/engine.rb +0 -2
- data/lib/metasploit_data_models/serialized_prefs.rb +0 -6
- data/lib/metasploit_data_models/version.rb +10 -24
- data/lib/tasks/yard.rake +33 -0
- data/metasploit_data_models.gemspec +2 -9
- data/spec/app/models/mdm/api_key_spec.rb +3 -1
- data/spec/app/models/mdm/client_spec.rb +11 -9
- data/spec/app/models/mdm/cred_spec.rb +54 -42
- data/spec/app/models/mdm/event_spec.rb +23 -21
- data/spec/app/models/mdm/exploit_attempt_spec.rb +21 -19
- data/spec/app/models/mdm/exploited_host_spec.rb +13 -11
- data/spec/app/models/mdm/host_detail_spec.rb +17 -15
- data/spec/app/models/mdm/host_spec.rb +260 -261
- data/spec/app/models/mdm/host_tag_spec.rb +8 -6
- data/spec/app/models/mdm/listener_spec.rb +32 -30
- data/spec/app/models/mdm/loot_spec.rb +23 -21
- data/spec/app/models/mdm/macro_spec.rb +3 -1
- data/spec/app/models/mdm/mod_ref_spec.rb +3 -1
- data/spec/app/models/mdm/module/action_spec.rb +12 -10
- data/spec/app/models/mdm/module/arch_spec.rb +12 -10
- data/spec/app/models/mdm/module/author_spec.rb +17 -22
- data/spec/app/models/mdm/module/detail_spec.rb +75 -184
- data/spec/app/models/mdm/module/mixin_spec.rb +12 -10
- data/spec/app/models/mdm/module/platform_spec.rb +12 -10
- data/spec/app/models/mdm/module/ref_spec.rb +12 -10
- data/spec/app/models/mdm/module/target_spec.rb +15 -13
- data/spec/app/models/mdm/nexpose_console_spec.rb +37 -35
- data/spec/app/models/mdm/note_spec.rb +25 -23
- data/spec/app/models/mdm/profile_spec.rb +3 -1
- data/spec/app/models/mdm/ref_spec.rb +12 -10
- data/spec/app/models/mdm/route_spec.rb +8 -6
- data/spec/app/models/mdm/service_spec.rb +40 -38
- data/spec/app/models/mdm/session_event_spec.rb +12 -10
- data/spec/app/models/mdm/session_spec.rb +15 -13
- data/spec/app/models/mdm/tag_spec.rb +29 -29
- data/spec/app/models/mdm/task_cred_spec.rb +11 -9
- data/spec/app/models/mdm/task_host_spec.rb +11 -9
- data/spec/app/models/mdm/task_service_spec.rb +11 -9
- data/spec/app/models/mdm/task_session_spec.rb +9 -7
- data/spec/app/models/mdm/task_spec.rb +29 -27
- data/spec/app/models/mdm/user_spec.rb +19 -17
- data/spec/app/models/mdm/vuln_attempt_spec.rb +16 -14
- data/spec/app/models/mdm/vuln_detail_spec.rb +28 -26
- data/spec/app/models/mdm/vuln_ref_spec.rb +10 -8
- data/spec/app/models/mdm/vuln_spec.rb +26 -24
- data/spec/app/models/mdm/web_form_spec.rb +13 -11
- data/spec/app/models/mdm/web_page_spec.rb +21 -19
- data/spec/app/models/mdm/web_site_spec.rb +23 -21
- data/spec/app/models/mdm/web_vuln_spec.rb +65 -63
- data/spec/app/models/mdm/wmap_request_spec.rb +3 -1
- data/spec/app/models/mdm/wmap_target_spec.rb +3 -1
- data/spec/app/models/mdm/workspace_spec.rb +100 -97
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +5 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +15 -13
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +12 -10
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +23 -21
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +11 -9
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +23 -21
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +15 -22
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +6 -4
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +3 -1
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +20 -18
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +8 -6
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +4 -2
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +10 -8
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +8 -6
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +11 -9
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +7 -5
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +19 -17
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +7 -5
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +23 -61
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +10 -8
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +46 -54
- data/spec/dummy/db/structure.sql +3403 -0
- data/spec/factories/mdm/module/details.rb +1 -1
- data/spec/lib/base64_serializer_spec.rb +19 -19
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +12 -18
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +6 -4
- data/spec/lib/metasploit_data_models/match/child_spec.rb +4 -2
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +6 -4
- data/spec/lib/metasploit_data_models/version_spec.rb +141 -3
- data/spec/spec_helper.rb +12 -86
- data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
- data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
- data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
- data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +6 -7
- metadata +9 -67
- data/CHANGELOG.md +0 -6
- data/RELEASING.md +0 -88
- data/UPGRADING.md +0 -1
- data/lib/metasploit_data_models/automatic_exploitation.rb +0 -25
- data/spec/lib/metasploit_data_models_spec.rb +0 -4
data/app/models/mdm/event.rb
CHANGED
|
@@ -1,60 +1,16 @@
|
|
|
1
|
-
# Records framework events to the database.
|
|
2
1
|
class Mdm::Event < ActiveRecord::Base
|
|
3
2
|
#
|
|
4
|
-
#
|
|
3
|
+
# Relations
|
|
5
4
|
#
|
|
6
5
|
|
|
7
|
-
# Host on which this event occurred.
|
|
8
|
-
#
|
|
9
|
-
# @return [Mdm::Host]
|
|
10
|
-
# @return [nil] if event did not occur on a host.
|
|
11
6
|
belongs_to :host,
|
|
12
7
|
class_name: 'Mdm::Host',
|
|
13
8
|
inverse_of: :events
|
|
14
9
|
|
|
15
|
-
# {Mdm::Workspace} in which this event occured. If {#host} is present, then this will match
|
|
16
|
-
# {Mdm::Host#workspace `host.workspace`}.
|
|
17
10
|
belongs_to :workspace,
|
|
18
11
|
class_name: 'Mdm::Workspace',
|
|
19
12
|
inverse_of: :events
|
|
20
13
|
|
|
21
|
-
#
|
|
22
|
-
# Attributes
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
# @!attribute created_at
|
|
26
|
-
# When this event was created.
|
|
27
|
-
#
|
|
28
|
-
# @return [DateTime]
|
|
29
|
-
|
|
30
|
-
# @!attribute critical
|
|
31
|
-
# Indicates if the event is critical.
|
|
32
|
-
#
|
|
33
|
-
# @return [false] event is not critical.
|
|
34
|
-
# @return [true] event is critical.
|
|
35
|
-
|
|
36
|
-
# @!attribute name
|
|
37
|
-
# Name of the event, such as 'module_run'.
|
|
38
|
-
#
|
|
39
|
-
# @return [String]
|
|
40
|
-
|
|
41
|
-
# @!attribute seen
|
|
42
|
-
# Whether a user has seen these events.
|
|
43
|
-
#
|
|
44
|
-
# @return [false] if the event has not been seen.
|
|
45
|
-
# @return [true] if any user has seen the event.
|
|
46
|
-
|
|
47
|
-
# @!attribute updated_at
|
|
48
|
-
# The last time this event was updated.
|
|
49
|
-
#
|
|
50
|
-
# @return [DateTime]
|
|
51
|
-
|
|
52
|
-
# @!attribute username
|
|
53
|
-
# Name of user that triggered the event. Not necessarily a {Mdm::User#username}, as {#username} may be set to
|
|
54
|
-
# the username of the user inferred from `ENV` when using metasploit-framework.
|
|
55
|
-
#
|
|
56
|
-
# @return [String]
|
|
57
|
-
|
|
58
14
|
#
|
|
59
15
|
# Scopes
|
|
60
16
|
#
|
|
@@ -66,9 +22,6 @@ class Mdm::Event < ActiveRecord::Base
|
|
|
66
22
|
# Serializations
|
|
67
23
|
#
|
|
68
24
|
|
|
69
|
-
# {#name}-specific information about this event.
|
|
70
|
-
#
|
|
71
|
-
# @return [Hash]
|
|
72
25
|
serialize :info, MetasploitDataModels::Base64Serializer.new
|
|
73
26
|
|
|
74
27
|
#
|
|
@@ -1,99 +1,50 @@
|
|
|
1
|
-
# An attempt to exploit {#host}.
|
|
2
1
|
class Mdm::ExploitAttempt < ActiveRecord::Base
|
|
3
2
|
#
|
|
4
3
|
# Associations
|
|
5
4
|
#
|
|
6
5
|
|
|
7
|
-
#
|
|
6
|
+
# @!attribute host
|
|
7
|
+
# Host that was attempted to be exploited.
|
|
8
8
|
#
|
|
9
|
-
#
|
|
9
|
+
# @return [Mdm::Host]
|
|
10
10
|
belongs_to :host,
|
|
11
11
|
class_name: 'Mdm::Host',
|
|
12
12
|
counter_cache: :exploit_attempt_count,
|
|
13
13
|
inverse_of: :exploit_attempts
|
|
14
14
|
|
|
15
|
-
#
|
|
15
|
+
# @!attribute loot
|
|
16
|
+
# Loot gathers from the successful exploit.
|
|
16
17
|
#
|
|
17
|
-
#
|
|
18
|
+
# @return [Mdm::Loot, nil]
|
|
18
19
|
belongs_to :loot,
|
|
19
20
|
class_name: 'Mdm::Loot',
|
|
20
21
|
inverse_of: :exploit_attempt
|
|
21
22
|
|
|
22
|
-
#
|
|
23
|
+
# @!attribute service
|
|
24
|
+
# The service being exploited on {#host}.
|
|
23
25
|
#
|
|
24
|
-
#
|
|
26
|
+
# @return [Mdm::Service, nil]
|
|
25
27
|
belongs_to :service,
|
|
26
28
|
class_name: 'Mdm::Service',
|
|
27
29
|
inverse_of: :exploit_attempts
|
|
28
30
|
|
|
29
|
-
#
|
|
31
|
+
# @!attribute session
|
|
32
|
+
# The session that was established when this attempt was successful.
|
|
30
33
|
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
34
|
+
# @return [Mdm::Session]
|
|
35
|
+
# @return [nil] if session was not established.
|
|
33
36
|
belongs_to :session,
|
|
34
37
|
class_name: 'Mdm::Session',
|
|
35
38
|
inverse_of: :exploit_attempt
|
|
36
39
|
|
|
37
|
-
#
|
|
40
|
+
# @!attribute vuln
|
|
41
|
+
# The vulnerability that was attempted to be exploited.
|
|
38
42
|
#
|
|
39
|
-
#
|
|
43
|
+
# @return [Mdm::Vuln, nil]
|
|
40
44
|
belongs_to :vuln,
|
|
41
45
|
class_name: 'Mdm::Vuln',
|
|
42
46
|
inverse_of: :exploit_attempts
|
|
43
47
|
|
|
44
|
-
#
|
|
45
|
-
# Attributes
|
|
46
|
-
#
|
|
47
|
-
|
|
48
|
-
# @!attribute attempted_at
|
|
49
|
-
# When the attempt was made.
|
|
50
|
-
#
|
|
51
|
-
# @return [DateTime]
|
|
52
|
-
|
|
53
|
-
# @!attribute exploited
|
|
54
|
-
# Whether the attempt was successful.
|
|
55
|
-
#
|
|
56
|
-
# @return [true] attempt was successful.
|
|
57
|
-
# @return [false] attempt was not successful.
|
|
58
|
-
|
|
59
|
-
# @!attribute fail_detail
|
|
60
|
-
# A more verbose reason (compared to {#fail_reason} for the failure.
|
|
61
|
-
#
|
|
62
|
-
# @return [String, nil]
|
|
63
|
-
|
|
64
|
-
# @!attribute fail_reason
|
|
65
|
-
# Summary of why the attempt failed if {#exploited} is `false`. For more details see {#fail_detail}.
|
|
66
|
-
#
|
|
67
|
-
# @return [String, nil]
|
|
68
|
-
|
|
69
|
-
# @!attribute host_id
|
|
70
|
-
# Foreign key to look up {#host}.
|
|
71
|
-
#
|
|
72
|
-
# @return [Integer]
|
|
73
|
-
|
|
74
|
-
# @!attribute module
|
|
75
|
-
# The full name of the exploit module that made the attempt.
|
|
76
|
-
#
|
|
77
|
-
# @return [String]
|
|
78
|
-
# @todo Remove deprecated Mdm::Exploit#module (MSP-9281)
|
|
79
|
-
|
|
80
|
-
# @!attribute port
|
|
81
|
-
# The port on {#host} which the exploit was attempted.
|
|
82
|
-
#
|
|
83
|
-
# @return [Integer]
|
|
84
|
-
# @todo Mdm::ExploitAttempt#port and Mdm::ExploitAttempt#proto are obsolete and should be removed (MSP-9284)
|
|
85
|
-
|
|
86
|
-
# @!attribute proto
|
|
87
|
-
# The protocol name used on {#port}.
|
|
88
|
-
#
|
|
89
|
-
# @return [String]
|
|
90
|
-
# @todo Mdm::ExploitAttempt#port and Mdm::ExploitAttempt#proto are obsolete and should be removed (MSP-9284)
|
|
91
|
-
|
|
92
|
-
# @!attribute username
|
|
93
|
-
# Name of user that made the attempt. May be an {Mdm::User#name} or a system username.
|
|
94
|
-
#
|
|
95
|
-
# @return [String]
|
|
96
|
-
|
|
97
48
|
#
|
|
98
49
|
# Validations
|
|
99
50
|
#
|
|
@@ -1,42 +1,15 @@
|
|
|
1
|
-
# @deprecated use {Mdm::ExploitAttempt} instead.
|
|
2
|
-
#
|
|
3
|
-
# When a {#host} or {#service} on a {#host} is exploited.
|
|
4
1
|
class Mdm::ExploitedHost < ActiveRecord::Base
|
|
5
2
|
#
|
|
6
|
-
#
|
|
3
|
+
# Relations
|
|
7
4
|
#
|
|
8
5
|
|
|
9
|
-
# The host that was exploited.
|
|
10
6
|
belongs_to :host,
|
|
11
7
|
class_name: 'Mdm::Host',
|
|
12
8
|
inverse_of: :exploited_hosts
|
|
13
9
|
|
|
14
|
-
# The service on {#host} that was exploited.
|
|
15
10
|
belongs_to :service,
|
|
16
11
|
class_name: 'Mdm::Service',
|
|
17
12
|
inverse_of: :exploited_hosts
|
|
18
13
|
|
|
19
|
-
#
|
|
20
|
-
# Attributes
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
# @!attribute name
|
|
24
|
-
# Name of exploit.
|
|
25
|
-
#
|
|
26
|
-
# @return [String]
|
|
27
|
-
|
|
28
|
-
# @!attribute payload
|
|
29
|
-
# {Mdm::Module::Class#full_name Full name of the payload module} used to exploit the {#host} or {#service} on
|
|
30
|
-
# {#host}.
|
|
31
|
-
#
|
|
32
|
-
# @return [String]
|
|
33
|
-
|
|
34
|
-
# @!attribute session_uuid
|
|
35
|
-
# UUID of local session.
|
|
36
|
-
#
|
|
37
|
-
# @return [String]
|
|
38
|
-
# @deprecated Sessions no longer have UUIDs. They have {Mdm::Session#local_id} that reflects the in-memory
|
|
39
|
-
# Msf::Session ID and an in-database {Mdm::Session#id}.
|
|
40
|
-
|
|
41
14
|
Metasploit::Concern.run(self)
|
|
42
15
|
end
|
|
@@ -1,57 +1,13 @@
|
|
|
1
|
-
# Details supplied by Nexpose about a {Mdm::Host host}.
|
|
2
1
|
class Mdm::HostDetail < ActiveRecord::Base
|
|
3
2
|
#
|
|
4
|
-
#
|
|
3
|
+
# Relations
|
|
5
4
|
#
|
|
6
5
|
|
|
7
|
-
# Host that this detail is about.
|
|
8
6
|
belongs_to :host,
|
|
9
7
|
class_name: 'Mdm::Host',
|
|
10
8
|
counter_cache: :host_detail_count,
|
|
11
9
|
inverse_of: :host_details
|
|
12
10
|
|
|
13
|
-
#
|
|
14
|
-
# Attributes
|
|
15
|
-
#
|
|
16
|
-
|
|
17
|
-
# @!attribute host_id
|
|
18
|
-
# The foreign key used to look up {#host}.
|
|
19
|
-
#
|
|
20
|
-
# @return [Integer]
|
|
21
|
-
|
|
22
|
-
# @!attribute nx_console_id
|
|
23
|
-
# The ID of the Nexpose console.
|
|
24
|
-
#
|
|
25
|
-
# @return [Integer]
|
|
26
|
-
|
|
27
|
-
# @!attribute nx_device_id
|
|
28
|
-
# The ID of the Device in Nexpose.
|
|
29
|
-
#
|
|
30
|
-
# @return [Integer]
|
|
31
|
-
|
|
32
|
-
# @!attribute nx_risk_score
|
|
33
|
-
# Risk score assigned by Nexpose. Useful to ordering hosts to determine which host to target first in metasploit.
|
|
34
|
-
#
|
|
35
|
-
# @return [Float]
|
|
36
|
-
|
|
37
|
-
# @!attribute nx_scan_template
|
|
38
|
-
# The template used by Nexpose to perform the scan on the {#nx_site_name site} on {#host}.
|
|
39
|
-
#
|
|
40
|
-
# @return [String]
|
|
41
|
-
|
|
42
|
-
# @!attribute nx_site_importance
|
|
43
|
-
# The importance of scanning the {#nx_site_name site} running on {#host} according to Nexpose.
|
|
44
|
-
#
|
|
45
|
-
# @return [String]
|
|
46
|
-
|
|
47
|
-
# @!attribute nx_site_name
|
|
48
|
-
# Name of site running on {#host} according to Nexpose.
|
|
49
|
-
#
|
|
50
|
-
# @return [String]
|
|
51
|
-
|
|
52
|
-
# @!attribute src
|
|
53
|
-
# @return [String]
|
|
54
|
-
|
|
55
11
|
#
|
|
56
12
|
# Validations
|
|
57
13
|
#
|
data/app/models/mdm/host_tag.rb
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
# Join model between {Mdm::Host} and {Mdm::Tag}.
|
|
2
1
|
class Mdm::HostTag < ActiveRecord::Base
|
|
3
2
|
self.table_name = "hosts_tags"
|
|
4
3
|
|
|
@@ -6,16 +5,20 @@ class Mdm::HostTag < ActiveRecord::Base
|
|
|
6
5
|
# Associations
|
|
7
6
|
#
|
|
8
7
|
|
|
9
|
-
#
|
|
8
|
+
# @!attribute host
|
|
9
|
+
# Host with {#tag}.
|
|
10
10
|
#
|
|
11
|
-
#
|
|
11
|
+
# @todo MSP-2723
|
|
12
|
+
# @return [Mdm::Host]
|
|
12
13
|
belongs_to :host,
|
|
13
14
|
class_name: 'Mdm::Host',
|
|
14
15
|
inverse_of: :hosts_tags
|
|
15
16
|
|
|
16
|
-
#
|
|
17
|
+
# @!attribute tag
|
|
18
|
+
# Tag on {#host}.
|
|
17
19
|
#
|
|
18
|
-
#
|
|
20
|
+
# @todo MSP-2723
|
|
21
|
+
# @return [Mdm::Tag]
|
|
19
22
|
belongs_to :tag,
|
|
20
23
|
class_name: 'Mdm::Tag',
|
|
21
24
|
inverse_of: :hosts_tags
|
|
@@ -41,7 +44,6 @@ class Mdm::HostTag < ActiveRecord::Base
|
|
|
41
44
|
tag.destroy_if_orphaned
|
|
42
45
|
end
|
|
43
46
|
|
|
44
|
-
# switch back to public for load hooks
|
|
45
47
|
public
|
|
46
48
|
|
|
47
49
|
Metasploit::Concern.run(self)
|
data/app/models/mdm/listener.rb
CHANGED
|
@@ -1,72 +1,20 @@
|
|
|
1
|
-
# A listener spawned by a {#task} that is waiting for connection on {#address}:{#port}.
|
|
2
1
|
class Mdm::Listener < ActiveRecord::Base
|
|
3
2
|
#
|
|
4
|
-
#
|
|
3
|
+
# Relations
|
|
5
4
|
#
|
|
6
5
|
|
|
7
|
-
# Task that spawned this listener.
|
|
8
6
|
belongs_to :task,
|
|
9
7
|
class_name: 'Mdm::Task',
|
|
10
8
|
inverse_of: :listeners
|
|
11
9
|
|
|
12
|
-
# Workspace which controls this listener.
|
|
13
10
|
belongs_to :workspace,
|
|
14
11
|
class_name: 'Mdm::Workspace',
|
|
15
12
|
inverse_of: :listeners
|
|
16
13
|
|
|
17
|
-
#
|
|
18
|
-
# Attributes
|
|
19
|
-
#
|
|
20
|
-
|
|
21
|
-
# @!attribute address
|
|
22
|
-
# The IP address to which the listener is bound.
|
|
23
|
-
#
|
|
24
|
-
# @return [String]
|
|
25
|
-
|
|
26
|
-
# @!attribute created_at
|
|
27
|
-
# When this listener was created. Not necessarily when it started listening.
|
|
28
|
-
#
|
|
29
|
-
# @return [DateTime]
|
|
30
|
-
|
|
31
|
-
# @!attribute enabled
|
|
32
|
-
# Whether listener is listening on {#address}:{#port}.
|
|
33
|
-
#
|
|
34
|
-
# @return [true] listener is listening.
|
|
35
|
-
# @return [false] listener is not listening.
|
|
36
|
-
|
|
37
|
-
# @!attribute macro
|
|
38
|
-
# {Mdm::Macro#name Name of macro} run when a connect is made to the listener.
|
|
39
|
-
#
|
|
40
|
-
# @return [String]
|
|
41
|
-
|
|
42
|
-
# @!attribute owner
|
|
43
|
-
# The name of the user that setup this listener.
|
|
44
|
-
#
|
|
45
|
-
# @return [String]
|
|
46
|
-
# @see Mdm::User#username
|
|
47
|
-
|
|
48
|
-
# @!attribute payload
|
|
49
|
-
# Reference name of the payload module that is sent when a connection is made to the listener.
|
|
50
|
-
#
|
|
51
|
-
# @return [String]
|
|
52
|
-
|
|
53
|
-
# @!attribute port
|
|
54
|
-
# Port on {#address} that listener is listening.
|
|
55
|
-
#
|
|
56
|
-
# @return [Integer]
|
|
57
|
-
|
|
58
|
-
# @!attribute updated_at
|
|
59
|
-
# The last time this listener was updated.
|
|
60
|
-
#
|
|
61
|
-
# @return [DateTime]
|
|
62
|
-
|
|
63
14
|
#
|
|
64
15
|
# Serializations
|
|
65
16
|
#
|
|
66
17
|
|
|
67
|
-
# Options used to spawn this listener.
|
|
68
|
-
#
|
|
69
|
-
# @return [Hash]
|
|
70
18
|
serialize :options, MetasploitDataModels::Base64Serializer.new
|
|
71
19
|
|
|
72
20
|
#
|
data/app/models/mdm/macro.rb
CHANGED
|
@@ -1,54 +1,12 @@
|
|
|
1
|
-
# Macro of {#actions} to run at once.
|
|
2
1
|
class Mdm::Macro < ActiveRecord::Base
|
|
3
2
|
extend MetasploitDataModels::SerializedPrefs
|
|
4
3
|
|
|
5
|
-
#
|
|
6
|
-
# Attributes
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
# @!attribute created_at
|
|
10
|
-
# When this macro was created.
|
|
11
|
-
#
|
|
12
|
-
# @return [DateTime]
|
|
13
|
-
|
|
14
|
-
# @!attribute description
|
|
15
|
-
# Long description of what the macro does.
|
|
16
|
-
#
|
|
17
|
-
# @return [String]
|
|
18
|
-
|
|
19
|
-
# @!attribute name
|
|
20
|
-
# The name of this macro.
|
|
21
|
-
#
|
|
22
|
-
# @return [String]
|
|
23
|
-
|
|
24
|
-
# @!attribute owner
|
|
25
|
-
# {Mdm::User#username Name of user} that owns this macro.
|
|
26
|
-
#
|
|
27
|
-
# @return [String]
|
|
28
|
-
|
|
29
|
-
# @!attribute updated_at
|
|
30
|
-
# When this macro was last updated.
|
|
31
|
-
#
|
|
32
|
-
# @return [DateTime]
|
|
33
|
-
|
|
34
4
|
#
|
|
35
5
|
# Serialization
|
|
36
6
|
#
|
|
37
7
|
|
|
38
|
-
# Actions run by this macro.
|
|
39
|
-
#
|
|
40
|
-
# @return [Array<Hash{Symbol=>Object}>] Array of action hashes. Each action hash is have key :module with value
|
|
41
|
-
# of an {Mdm::Module::Detail#fullname} and and key :options with value of options used to the run the module.
|
|
42
8
|
serialize :actions, MetasploitDataModels::Base64Serializer.new
|
|
43
|
-
|
|
44
|
-
# Preference for this macro, shared across all actions.
|
|
45
|
-
#
|
|
46
|
-
# @return [Hash]
|
|
47
9
|
serialize :prefs, MetasploitDataModels::Base64Serializer.new
|
|
48
|
-
|
|
49
|
-
# The maximum number of seconds that this macro is allowed to run.
|
|
50
|
-
#
|
|
51
|
-
# @return [Integer]
|
|
52
10
|
serialized_prefs_attr_accessor :max_time
|
|
53
11
|
|
|
54
12
|
#
|