metasploit_data_models 1.0.0.pre.rails.pre.4.0b → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +2 -2
- data/.travis.yml +6 -3
- data/CHANGELOG.md +6 -0
- data/CONTRIBUTING.md +10 -52
- data/Gemfile +4 -6
- data/RELEASING.md +88 -0
- data/Rakefile +23 -0
- data/UPGRADING.md +1 -0
- data/app/models/mdm/api_key.rb +41 -1
- data/app/models/mdm/client.rb +41 -1
- data/app/models/mdm/cred.rb +116 -28
- data/app/models/mdm/event.rb +47 -0
- data/app/models/mdm/exploit_attempt.rb +65 -16
- data/app/models/mdm/exploited_host.rb +27 -0
- data/app/models/mdm/host_detail.rb +44 -0
- data/app/models/mdm/host_tag.rb +6 -8
- data/app/models/mdm/listener.rb +52 -0
- data/app/models/mdm/macro.rb +42 -0
- data/app/models/mdm/mod_ref.rb +21 -1
- data/app/models/mdm/module/action.rb +15 -0
- data/app/models/mdm/module/arch.rb +10 -0
- data/app/models/mdm/module/author.rb +17 -1
- data/app/models/mdm/module/mixin.rb +13 -0
- data/app/models/mdm/module/platform.rb +11 -0
- data/app/models/mdm/module/target.rb +18 -0
- data/app/models/mdm/nexpose_console.rb +82 -4
- data/app/models/mdm/profile.rb +36 -0
- data/app/models/mdm/route.rb +16 -4
- data/app/models/mdm/session_event.rb +32 -0
- data/app/models/mdm/tag.rb +48 -9
- data/app/models/mdm/task.rb +85 -46
- data/app/models/mdm/task_cred.rb +29 -0
- data/app/models/mdm/task_host.rb +25 -0
- data/app/models/mdm/task_service.rb +25 -0
- data/app/models/mdm/task_session.rb +25 -0
- data/app/models/mdm/user.rb +192 -6
- data/app/models/mdm/vuln_attempt.rb +37 -12
- data/app/models/mdm/vuln_detail.rb +138 -5
- data/app/models/mdm/vuln_ref.rb +3 -0
- data/app/models/mdm/web_form.rb +34 -0
- data/app/models/mdm/web_page.rb +69 -0
- data/app/models/mdm/web_site.rb +50 -0
- data/app/models/mdm/wmap_request.rb +85 -0
- data/app/models/mdm/wmap_target.rb +40 -0
- data/app/models/mdm/workspace.rb +160 -17
- data/app/models/metasploit_data_models/automatic_exploitation/match.rb +13 -23
- data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +25 -4
- data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +15 -4
- data/app/models/metasploit_data_models/automatic_exploitation/run.rb +7 -3
- 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 +4 -0
- data/app/validators/parameters_validator.rb +12 -0
- data/app/validators/password_is_strong_validator.rb +10 -1
- data/lib/mdm/host/operating_system_normalization.rb +7 -10
- data/lib/metasploit_data_models.rb +4 -0
- data/lib/metasploit_data_models/automatic_exploitation.rb +25 -0
- data/lib/metasploit_data_models/engine.rb +2 -0
- data/lib/metasploit_data_models/serialized_prefs.rb +6 -0
- data/lib/metasploit_data_models/version.rb +30 -7
- data/metasploit_data_models.gemspec +9 -2
- data/spec/app/models/mdm/api_key_spec.rb +1 -3
- data/spec/app/models/mdm/client_spec.rb +9 -11
- data/spec/app/models/mdm/cred_spec.rb +42 -54
- data/spec/app/models/mdm/event_spec.rb +22 -24
- data/spec/app/models/mdm/exploit_attempt_spec.rb +19 -21
- data/spec/app/models/mdm/exploited_host_spec.rb +11 -13
- data/spec/app/models/mdm/host_detail_spec.rb +15 -17
- data/spec/app/models/mdm/host_spec.rb +262 -260
- data/spec/app/models/mdm/host_tag_spec.rb +6 -8
- data/spec/app/models/mdm/listener_spec.rb +30 -32
- data/spec/app/models/mdm/loot_spec.rb +21 -23
- data/spec/app/models/mdm/macro_spec.rb +1 -3
- data/spec/app/models/mdm/mod_ref_spec.rb +1 -3
- data/spec/app/models/mdm/module/action_spec.rb +8 -10
- data/spec/app/models/mdm/module/arch_spec.rb +8 -10
- data/spec/app/models/mdm/module/author_spec.rb +19 -14
- data/spec/app/models/mdm/module/detail_spec.rb +184 -75
- data/spec/app/models/mdm/module/mixin_spec.rb +8 -10
- data/spec/app/models/mdm/module/platform_spec.rb +8 -10
- data/spec/app/models/mdm/module/ref_spec.rb +8 -10
- data/spec/app/models/mdm/module/target_spec.rb +10 -12
- data/spec/app/models/mdm/nexpose_console_spec.rb +35 -37
- data/spec/app/models/mdm/note_spec.rb +23 -25
- data/spec/app/models/mdm/profile_spec.rb +1 -3
- data/spec/app/models/mdm/ref_spec.rb +9 -12
- data/spec/app/models/mdm/route_spec.rb +6 -8
- data/spec/app/models/mdm/service_spec.rb +38 -40
- data/spec/app/models/mdm/session_event_spec.rb +10 -12
- data/spec/app/models/mdm/session_spec.rb +13 -15
- data/spec/app/models/mdm/tag_spec.rb +29 -30
- data/spec/app/models/mdm/task_cred_spec.rb +9 -11
- data/spec/app/models/mdm/task_host_spec.rb +9 -11
- data/spec/app/models/mdm/task_service_spec.rb +9 -11
- data/spec/app/models/mdm/task_session_spec.rb +7 -9
- data/spec/app/models/mdm/task_spec.rb +27 -29
- data/spec/app/models/mdm/user_spec.rb +17 -19
- data/spec/app/models/mdm/vuln_attempt_spec.rb +14 -16
- data/spec/app/models/mdm/vuln_detail_spec.rb +26 -28
- data/spec/app/models/mdm/vuln_ref_spec.rb +8 -10
- data/spec/app/models/mdm/vuln_spec.rb +24 -26
- data/spec/app/models/mdm/web_form_spec.rb +11 -13
- data/spec/app/models/mdm/web_page_spec.rb +19 -21
- data/spec/app/models/mdm/web_site_spec.rb +21 -23
- data/spec/app/models/mdm/web_vuln_spec.rb +63 -65
- data/spec/app/models/mdm/wmap_request_spec.rb +1 -3
- data/spec/app/models/mdm/wmap_target_spec.rb +1 -3
- data/spec/app/models/mdm/workspace_spec.rb +97 -100
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +3 -5
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +13 -15
- data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +10 -12
- data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +21 -23
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +22 -15
- data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +4 -6
- data/spec/app/models/metasploit_data_models/module_run_spec.rb +1 -3
- data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +18 -20
- data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +2 -4
- data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +8 -10
- data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +6 -8
- data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +9 -11
- data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +17 -19
- data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +5 -7
- data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +61 -23
- data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +8 -10
- data/spec/app/validators/parameters_validator_spec.rb +29 -29
- data/spec/app/validators/password_is_strong_validator_spec.rb +54 -46
- data/spec/lib/base64_serializer_spec.rb +19 -21
- data/spec/lib/ipaddr_spec.rb +1 -3
- data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +18 -12
- data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/match/child_spec.rb +2 -4
- data/spec/lib/metasploit_data_models/match/parent_spec.rb +4 -6
- data/spec/lib/metasploit_data_models/version_spec.rb +3 -139
- data/spec/lib/metasploit_data_models_spec.rb +4 -0
- data/spec/spec_helper.rb +86 -12
- 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 +7 -6
- metadata +74 -14
- data/app/models/metasploit_data_models/automatic_exploitation.rb +0 -16
- data/lib/tasks/yard.rake +0 -33
data/app/models/mdm/event.rb
CHANGED
@@ -1,17 +1,61 @@
|
|
1
|
+
# Records framework events to the database.
|
1
2
|
class Mdm::Event < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
8
|
+
# Host on which this event occurred.
|
9
|
+
#
|
10
|
+
# @return [Mdm::Host]
|
11
|
+
# @return [nil] if event did not occur on a host.
|
7
12
|
belongs_to :host,
|
8
13
|
class_name: 'Mdm::Host',
|
9
14
|
inverse_of: :events
|
10
15
|
|
16
|
+
# {Mdm::Workspace} in which this event occured. If {#host} is present, then this will match
|
17
|
+
# {Mdm::Host#workspace `host.workspace`}.
|
11
18
|
belongs_to :workspace,
|
12
19
|
class_name: 'Mdm::Workspace',
|
13
20
|
inverse_of: :events
|
14
21
|
|
22
|
+
#
|
23
|
+
# Attributes
|
24
|
+
#
|
25
|
+
|
26
|
+
# @!attribute created_at
|
27
|
+
# When this event was created.
|
28
|
+
#
|
29
|
+
# @return [DateTime]
|
30
|
+
|
31
|
+
# @!attribute critical
|
32
|
+
# Indicates if the event is critical.
|
33
|
+
#
|
34
|
+
# @return [false] event is not critical.
|
35
|
+
# @return [true] event is critical.
|
36
|
+
|
37
|
+
# @!attribute name
|
38
|
+
# Name of the event, such as 'module_run'.
|
39
|
+
#
|
40
|
+
# @return [String]
|
41
|
+
|
42
|
+
# @!attribute seen
|
43
|
+
# Whether a user has seen these events.
|
44
|
+
#
|
45
|
+
# @return [false] if the event has not been seen.
|
46
|
+
# @return [true] if any user has seen the event.
|
47
|
+
|
48
|
+
# @!attribute updated_at
|
49
|
+
# The last time this event was updated.
|
50
|
+
#
|
51
|
+
# @return [DateTime]
|
52
|
+
|
53
|
+
# @!attribute username
|
54
|
+
# Name of user that triggered the event. Not necessarily a {Mdm::User#username}, as {#username} may be set to
|
55
|
+
# the username of the user inferred from `ENV` when using metasploit-framework.
|
56
|
+
#
|
57
|
+
# @return [String]
|
58
|
+
|
15
59
|
#
|
16
60
|
# Scopes
|
17
61
|
#
|
@@ -23,6 +67,9 @@ class Mdm::Event < ActiveRecord::Base
|
|
23
67
|
# Serializations
|
24
68
|
#
|
25
69
|
|
70
|
+
# {#name}-specific information about this event.
|
71
|
+
#
|
72
|
+
# @return [Hash]
|
26
73
|
serialize :info, MetasploitDataModels::Base64Serializer.new
|
27
74
|
|
28
75
|
#
|
@@ -1,51 +1,100 @@
|
|
1
|
+
# An attempt to exploit {#host}.
|
1
2
|
class Mdm::ExploitAttempt < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
7
|
-
#
|
8
|
-
# Host that was attempted to be exploited.
|
8
|
+
# Host that was attempted to be exploited.
|
9
9
|
#
|
10
|
-
#
|
10
|
+
# @return [Mdm::Host]
|
11
11
|
belongs_to :host,
|
12
12
|
class_name: 'Mdm::Host',
|
13
13
|
counter_cache: :exploit_attempt_count,
|
14
14
|
inverse_of: :exploit_attempts
|
15
15
|
|
16
|
-
#
|
17
|
-
# Loot gathers from the successful exploit.
|
16
|
+
# Loot gathers from the successful exploit.
|
18
17
|
#
|
19
|
-
#
|
18
|
+
# @return [Mdm::Loot, nil]
|
20
19
|
belongs_to :loot,
|
21
20
|
class_name: 'Mdm::Loot',
|
22
21
|
inverse_of: :exploit_attempt
|
23
22
|
|
24
|
-
#
|
25
|
-
# The service being exploited on {#host}.
|
23
|
+
# The service being exploited on {#host}.
|
26
24
|
#
|
27
|
-
#
|
25
|
+
# @return [Mdm::Service, nil]
|
28
26
|
belongs_to :service,
|
29
27
|
class_name: 'Mdm::Service',
|
30
28
|
inverse_of: :exploit_attempts
|
31
29
|
|
32
|
-
#
|
33
|
-
# The session that was established when this attempt was successful.
|
30
|
+
# The session that was established when this attempt was successful.
|
34
31
|
#
|
35
|
-
#
|
36
|
-
#
|
32
|
+
# @return [Mdm::Session]
|
33
|
+
# @return [nil] if session was not established.
|
37
34
|
belongs_to :session,
|
38
35
|
class_name: 'Mdm::Session',
|
39
36
|
inverse_of: :exploit_attempt
|
40
37
|
|
41
|
-
#
|
42
|
-
# The vulnerability that was attempted to be exploited.
|
38
|
+
# The vulnerability that was attempted to be exploited.
|
43
39
|
#
|
44
|
-
#
|
40
|
+
# @return [Mdm::Vuln, nil]
|
45
41
|
belongs_to :vuln,
|
46
42
|
class_name: 'Mdm::Vuln',
|
47
43
|
inverse_of: :exploit_attempts
|
48
44
|
|
45
|
+
#
|
46
|
+
# Attributes
|
47
|
+
#
|
48
|
+
|
49
|
+
# @!attribute attempted_at
|
50
|
+
# When the attempt was made.
|
51
|
+
#
|
52
|
+
# @return [DateTime]
|
53
|
+
|
54
|
+
# @!attribute exploited
|
55
|
+
# Whether the attempt was successful.
|
56
|
+
#
|
57
|
+
# @return [true] attempt was successful.
|
58
|
+
# @return [false] attempt was not successful.
|
59
|
+
|
60
|
+
# @!attribute fail_detail
|
61
|
+
# A more verbose reason (compared to {#fail_reason} for the failure.
|
62
|
+
#
|
63
|
+
# @return [String, nil]
|
64
|
+
|
65
|
+
# @!attribute fail_reason
|
66
|
+
# Summary of why the attempt failed if {#exploited} is `false`. For more details see {#fail_detail}.
|
67
|
+
#
|
68
|
+
# @return [String, nil]
|
69
|
+
|
70
|
+
# @!attribute host_id
|
71
|
+
# Foreign key to look up {#host}.
|
72
|
+
#
|
73
|
+
# @return [Integer]
|
74
|
+
|
75
|
+
# @!attribute module
|
76
|
+
# The full name of the exploit module that made the attempt.
|
77
|
+
#
|
78
|
+
# @return [String]
|
79
|
+
# @todo Remove deprecated Mdm::Exploit#module (MSP-9281)
|
80
|
+
|
81
|
+
# @!attribute port
|
82
|
+
# The port on {#host} which the exploit was attempted.
|
83
|
+
#
|
84
|
+
# @return [Integer]
|
85
|
+
# @todo Mdm::ExploitAttempt#port and Mdm::ExploitAttempt#proto are obsolete and should be removed (MSP-9284)
|
86
|
+
|
87
|
+
# @!attribute proto
|
88
|
+
# The protocol name used on {#port}.
|
89
|
+
#
|
90
|
+
# @return [String]
|
91
|
+
# @todo Mdm::ExploitAttempt#port and Mdm::ExploitAttempt#proto are obsolete and should be removed (MSP-9284)
|
92
|
+
|
93
|
+
# @!attribute username
|
94
|
+
# Name of user that made the attempt. May be an {Mdm::User#name} or a system username.
|
95
|
+
#
|
96
|
+
# @return [String]
|
97
|
+
|
49
98
|
#
|
50
99
|
# Validations
|
51
100
|
#
|
@@ -1,15 +1,42 @@
|
|
1
|
+
# @deprecated use {Mdm::ExploitAttempt} instead.
|
2
|
+
#
|
3
|
+
# When a {#host} or {#service} on a {#host} is exploited.
|
1
4
|
class Mdm::ExploitedHost < ActiveRecord::Base
|
2
5
|
#
|
3
6
|
# Associations
|
4
7
|
#
|
5
8
|
|
9
|
+
# The host that was exploited.
|
6
10
|
belongs_to :host,
|
7
11
|
class_name: 'Mdm::Host',
|
8
12
|
inverse_of: :exploited_hosts
|
9
13
|
|
14
|
+
# The service on {#host} that was exploited.
|
10
15
|
belongs_to :service,
|
11
16
|
class_name: 'Mdm::Service',
|
12
17
|
inverse_of: :exploited_hosts
|
13
18
|
|
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
|
+
|
14
41
|
Metasploit::Concern.run(self)
|
15
42
|
end
|
@@ -1,13 +1,57 @@
|
|
1
|
+
# Details supplied by Nexpose about a {Mdm::Host host}.
|
1
2
|
class Mdm::HostDetail < ActiveRecord::Base
|
2
3
|
#
|
3
4
|
# Associations
|
4
5
|
#
|
5
6
|
|
7
|
+
# Host that this detail is about.
|
6
8
|
belongs_to :host,
|
7
9
|
class_name: 'Mdm::Host',
|
8
10
|
counter_cache: :host_detail_count,
|
9
11
|
inverse_of: :host_details
|
10
12
|
|
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
|
+
|
11
55
|
#
|
12
56
|
# Validations
|
13
57
|
#
|
data/app/models/mdm/host_tag.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# Join model between {Mdm::Host} and {Mdm::Tag}.
|
1
2
|
class Mdm::HostTag < ActiveRecord::Base
|
2
3
|
self.table_name = "hosts_tags"
|
3
4
|
|
@@ -5,20 +6,16 @@ class Mdm::HostTag < ActiveRecord::Base
|
|
5
6
|
# Associations
|
6
7
|
#
|
7
8
|
|
8
|
-
#
|
9
|
-
# Host with {#tag}.
|
9
|
+
# Host with {#tag}.
|
10
10
|
#
|
11
|
-
#
|
12
|
-
# @return [Mdm::Host]
|
11
|
+
# @todo MSP-2723
|
13
12
|
belongs_to :host,
|
14
13
|
class_name: 'Mdm::Host',
|
15
14
|
inverse_of: :hosts_tags
|
16
15
|
|
17
|
-
#
|
18
|
-
# Tag on {#host}.
|
16
|
+
# Tag on {#host}.
|
19
17
|
#
|
20
|
-
#
|
21
|
-
# @return [Mdm::Tag]
|
18
|
+
# @todo MSP-2723
|
22
19
|
belongs_to :tag,
|
23
20
|
class_name: 'Mdm::Tag',
|
24
21
|
inverse_of: :hosts_tags
|
@@ -44,6 +41,7 @@ class Mdm::HostTag < ActiveRecord::Base
|
|
44
41
|
tag.destroy_if_orphaned
|
45
42
|
end
|
46
43
|
|
44
|
+
# switch back to public for load hooks
|
47
45
|
public
|
48
46
|
|
49
47
|
Metasploit::Concern.run(self)
|
data/app/models/mdm/listener.rb
CHANGED
@@ -1,21 +1,73 @@
|
|
1
|
+
# A listener spawned by a {#task} that is waiting for connection on {#address}:{#port}.
|
1
2
|
class Mdm::Listener < ActiveRecord::Base
|
2
3
|
|
3
4
|
#
|
4
5
|
# Associations
|
5
6
|
#
|
6
7
|
|
8
|
+
# Task that spawned this listener.
|
7
9
|
belongs_to :task,
|
8
10
|
class_name: 'Mdm::Task',
|
9
11
|
inverse_of: :listeners
|
10
12
|
|
13
|
+
# Workspace which controls this listener.
|
11
14
|
belongs_to :workspace,
|
12
15
|
class_name: 'Mdm::Workspace',
|
13
16
|
inverse_of: :listeners
|
14
17
|
|
18
|
+
#
|
19
|
+
# Attributes
|
20
|
+
#
|
21
|
+
|
22
|
+
# @!attribute address
|
23
|
+
# The IP address to which the listener is bound.
|
24
|
+
#
|
25
|
+
# @return [String]
|
26
|
+
|
27
|
+
# @!attribute created_at
|
28
|
+
# When this listener was created. Not necessarily when it started listening.
|
29
|
+
#
|
30
|
+
# @return [DateTime]
|
31
|
+
|
32
|
+
# @!attribute enabled
|
33
|
+
# Whether listener is listening on {#address}:{#port}.
|
34
|
+
#
|
35
|
+
# @return [true] listener is listening.
|
36
|
+
# @return [false] listener is not listening.
|
37
|
+
|
38
|
+
# @!attribute macro
|
39
|
+
# {Mdm::Macro#name Name of macro} run when a connect is made to the listener.
|
40
|
+
#
|
41
|
+
# @return [String]
|
42
|
+
|
43
|
+
# @!attribute owner
|
44
|
+
# The name of the user that setup this listener.
|
45
|
+
#
|
46
|
+
# @return [String]
|
47
|
+
# @see Mdm::User#username
|
48
|
+
|
49
|
+
# @!attribute payload
|
50
|
+
# Reference name of the payload module that is sent when a connection is made to the listener.
|
51
|
+
#
|
52
|
+
# @return [String]
|
53
|
+
|
54
|
+
# @!attribute port
|
55
|
+
# Port on {#address} that listener is listening.
|
56
|
+
#
|
57
|
+
# @return [Integer]
|
58
|
+
|
59
|
+
# @!attribute updated_at
|
60
|
+
# The last time this listener was updated.
|
61
|
+
#
|
62
|
+
# @return [DateTime]
|
63
|
+
|
15
64
|
#
|
16
65
|
# Serializations
|
17
66
|
#
|
18
67
|
|
68
|
+
# Options used to spawn this listener.
|
69
|
+
#
|
70
|
+
# @return [Hash]
|
19
71
|
serialize :options, MetasploitDataModels::Base64Serializer.new
|
20
72
|
|
21
73
|
#
|
data/app/models/mdm/macro.rb
CHANGED
@@ -1,12 +1,54 @@
|
|
1
|
+
# Macro of {#actions} to run at once.
|
1
2
|
class Mdm::Macro < ActiveRecord::Base
|
2
3
|
extend MetasploitDataModels::SerializedPrefs
|
3
4
|
|
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
|
+
|
4
34
|
#
|
5
35
|
# Serialization
|
6
36
|
#
|
7
37
|
|
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.
|
8
42
|
serialize :actions, MetasploitDataModels::Base64Serializer.new
|
43
|
+
|
44
|
+
# Preference for this macro, shared across all actions.
|
45
|
+
#
|
46
|
+
# @return [Hash]
|
9
47
|
serialize :prefs, MetasploitDataModels::Base64Serializer.new
|
48
|
+
|
49
|
+
# The maximum number of seconds that this macro is allowed to run.
|
50
|
+
#
|
51
|
+
# @return [Integer]
|
10
52
|
serialized_prefs_attr_accessor :max_time
|
11
53
|
|
12
54
|
#
|