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.
Files changed (157) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -2
  3. data/.travis.yml +6 -3
  4. data/CHANGELOG.md +6 -0
  5. data/CONTRIBUTING.md +10 -52
  6. data/Gemfile +4 -6
  7. data/RELEASING.md +88 -0
  8. data/Rakefile +23 -0
  9. data/UPGRADING.md +1 -0
  10. data/app/models/mdm/api_key.rb +41 -1
  11. data/app/models/mdm/client.rb +41 -1
  12. data/app/models/mdm/cred.rb +116 -28
  13. data/app/models/mdm/event.rb +47 -0
  14. data/app/models/mdm/exploit_attempt.rb +65 -16
  15. data/app/models/mdm/exploited_host.rb +27 -0
  16. data/app/models/mdm/host_detail.rb +44 -0
  17. data/app/models/mdm/host_tag.rb +6 -8
  18. data/app/models/mdm/listener.rb +52 -0
  19. data/app/models/mdm/macro.rb +42 -0
  20. data/app/models/mdm/mod_ref.rb +21 -1
  21. data/app/models/mdm/module/action.rb +15 -0
  22. data/app/models/mdm/module/arch.rb +10 -0
  23. data/app/models/mdm/module/author.rb +17 -1
  24. data/app/models/mdm/module/mixin.rb +13 -0
  25. data/app/models/mdm/module/platform.rb +11 -0
  26. data/app/models/mdm/module/target.rb +18 -0
  27. data/app/models/mdm/nexpose_console.rb +82 -4
  28. data/app/models/mdm/profile.rb +36 -0
  29. data/app/models/mdm/route.rb +16 -4
  30. data/app/models/mdm/session_event.rb +32 -0
  31. data/app/models/mdm/tag.rb +48 -9
  32. data/app/models/mdm/task.rb +85 -46
  33. data/app/models/mdm/task_cred.rb +29 -0
  34. data/app/models/mdm/task_host.rb +25 -0
  35. data/app/models/mdm/task_service.rb +25 -0
  36. data/app/models/mdm/task_session.rb +25 -0
  37. data/app/models/mdm/user.rb +192 -6
  38. data/app/models/mdm/vuln_attempt.rb +37 -12
  39. data/app/models/mdm/vuln_detail.rb +138 -5
  40. data/app/models/mdm/vuln_ref.rb +3 -0
  41. data/app/models/mdm/web_form.rb +34 -0
  42. data/app/models/mdm/web_page.rb +69 -0
  43. data/app/models/mdm/web_site.rb +50 -0
  44. data/app/models/mdm/wmap_request.rb +85 -0
  45. data/app/models/mdm/wmap_target.rb +40 -0
  46. data/app/models/mdm/workspace.rb +160 -17
  47. data/app/models/metasploit_data_models/automatic_exploitation/match.rb +13 -23
  48. data/app/models/metasploit_data_models/automatic_exploitation/match_result.rb +25 -4
  49. data/app/models/metasploit_data_models/automatic_exploitation/match_set.rb +15 -4
  50. data/app/models/metasploit_data_models/automatic_exploitation/run.rb +7 -3
  51. data/app/models/metasploit_data_models/ip_address/v4/segmented.rb +1 -1
  52. data/app/models/metasploit_data_models/module_run.rb +1 -1
  53. data/app/models/metasploit_data_models/search/visitor/where.rb +1 -1
  54. data/app/validators/ip_format_validator.rb +4 -0
  55. data/app/validators/parameters_validator.rb +12 -0
  56. data/app/validators/password_is_strong_validator.rb +10 -1
  57. data/lib/mdm/host/operating_system_normalization.rb +7 -10
  58. data/lib/metasploit_data_models.rb +4 -0
  59. data/lib/metasploit_data_models/automatic_exploitation.rb +25 -0
  60. data/lib/metasploit_data_models/engine.rb +2 -0
  61. data/lib/metasploit_data_models/serialized_prefs.rb +6 -0
  62. data/lib/metasploit_data_models/version.rb +30 -7
  63. data/metasploit_data_models.gemspec +9 -2
  64. data/spec/app/models/mdm/api_key_spec.rb +1 -3
  65. data/spec/app/models/mdm/client_spec.rb +9 -11
  66. data/spec/app/models/mdm/cred_spec.rb +42 -54
  67. data/spec/app/models/mdm/event_spec.rb +22 -24
  68. data/spec/app/models/mdm/exploit_attempt_spec.rb +19 -21
  69. data/spec/app/models/mdm/exploited_host_spec.rb +11 -13
  70. data/spec/app/models/mdm/host_detail_spec.rb +15 -17
  71. data/spec/app/models/mdm/host_spec.rb +262 -260
  72. data/spec/app/models/mdm/host_tag_spec.rb +6 -8
  73. data/spec/app/models/mdm/listener_spec.rb +30 -32
  74. data/spec/app/models/mdm/loot_spec.rb +21 -23
  75. data/spec/app/models/mdm/macro_spec.rb +1 -3
  76. data/spec/app/models/mdm/mod_ref_spec.rb +1 -3
  77. data/spec/app/models/mdm/module/action_spec.rb +8 -10
  78. data/spec/app/models/mdm/module/arch_spec.rb +8 -10
  79. data/spec/app/models/mdm/module/author_spec.rb +19 -14
  80. data/spec/app/models/mdm/module/detail_spec.rb +184 -75
  81. data/spec/app/models/mdm/module/mixin_spec.rb +8 -10
  82. data/spec/app/models/mdm/module/platform_spec.rb +8 -10
  83. data/spec/app/models/mdm/module/ref_spec.rb +8 -10
  84. data/spec/app/models/mdm/module/target_spec.rb +10 -12
  85. data/spec/app/models/mdm/nexpose_console_spec.rb +35 -37
  86. data/spec/app/models/mdm/note_spec.rb +23 -25
  87. data/spec/app/models/mdm/profile_spec.rb +1 -3
  88. data/spec/app/models/mdm/ref_spec.rb +9 -12
  89. data/spec/app/models/mdm/route_spec.rb +6 -8
  90. data/spec/app/models/mdm/service_spec.rb +38 -40
  91. data/spec/app/models/mdm/session_event_spec.rb +10 -12
  92. data/spec/app/models/mdm/session_spec.rb +13 -15
  93. data/spec/app/models/mdm/tag_spec.rb +29 -30
  94. data/spec/app/models/mdm/task_cred_spec.rb +9 -11
  95. data/spec/app/models/mdm/task_host_spec.rb +9 -11
  96. data/spec/app/models/mdm/task_service_spec.rb +9 -11
  97. data/spec/app/models/mdm/task_session_spec.rb +7 -9
  98. data/spec/app/models/mdm/task_spec.rb +27 -29
  99. data/spec/app/models/mdm/user_spec.rb +17 -19
  100. data/spec/app/models/mdm/vuln_attempt_spec.rb +14 -16
  101. data/spec/app/models/mdm/vuln_detail_spec.rb +26 -28
  102. data/spec/app/models/mdm/vuln_ref_spec.rb +8 -10
  103. data/spec/app/models/mdm/vuln_spec.rb +24 -26
  104. data/spec/app/models/mdm/web_form_spec.rb +11 -13
  105. data/spec/app/models/mdm/web_page_spec.rb +19 -21
  106. data/spec/app/models/mdm/web_site_spec.rb +21 -23
  107. data/spec/app/models/mdm/web_vuln_spec.rb +63 -65
  108. data/spec/app/models/mdm/wmap_request_spec.rb +1 -3
  109. data/spec/app/models/mdm/wmap_target_spec.rb +1 -3
  110. data/spec/app/models/mdm/workspace_spec.rb +97 -100
  111. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_result_spec.rb +3 -5
  112. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_set_spec.rb +13 -15
  113. data/spec/app/models/metasploit_data_models/automatic_exploitation/match_spec.rb +1 -3
  114. data/spec/app/models/metasploit_data_models/automatic_exploitation/run_spec.rb +1 -3
  115. data/spec/app/models/metasploit_data_models/ip_address/v4/cidr_spec.rb +10 -12
  116. data/spec/app/models/metasploit_data_models/ip_address/v4/nmap_spec.rb +4 -6
  117. data/spec/app/models/metasploit_data_models/ip_address/v4/range_spec.rb +21 -23
  118. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/list_spec.rb +9 -11
  119. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/nmap/range_spec.rb +21 -23
  120. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/segmented_spec.rb +4 -6
  121. data/spec/app/models/metasploit_data_models/ip_address/v4/segment/single_spec.rb +22 -15
  122. data/spec/app/models/metasploit_data_models/ip_address/v4/single_spec.rb +4 -6
  123. data/spec/app/models/metasploit_data_models/module_run_spec.rb +1 -3
  124. data/spec/app/models/metasploit_data_models/search/operation/ip_address_spec.rb +18 -20
  125. data/spec/app/models/metasploit_data_models/search/operation/port/number_spec.rb +6 -8
  126. data/spec/app/models/metasploit_data_models/search/operation/port/range_spec.rb +8 -10
  127. data/spec/app/models/metasploit_data_models/search/operation/range_spec.rb +8 -10
  128. data/spec/app/models/metasploit_data_models/search/operator/ip_address_spec.rb +2 -4
  129. data/spec/app/models/metasploit_data_models/search/operator/multitext_spec.rb +8 -10
  130. data/spec/app/models/metasploit_data_models/search/operator/port/list_spec.rb +6 -8
  131. data/spec/app/models/metasploit_data_models/search/visitor/attribute_spec.rb +9 -11
  132. data/spec/app/models/metasploit_data_models/search/visitor/includes_spec.rb +5 -7
  133. data/spec/app/models/metasploit_data_models/search/visitor/joins_spec.rb +17 -19
  134. data/spec/app/models/metasploit_data_models/search/visitor/method_spec.rb +5 -7
  135. data/spec/app/models/metasploit_data_models/search/visitor/relation_spec.rb +61 -23
  136. data/spec/app/models/metasploit_data_models/search/visitor/where_spec.rb +8 -10
  137. data/spec/app/validators/parameters_validator_spec.rb +29 -29
  138. data/spec/app/validators/password_is_strong_validator_spec.rb +54 -46
  139. data/spec/lib/base64_serializer_spec.rb +19 -21
  140. data/spec/lib/ipaddr_spec.rb +1 -3
  141. data/spec/lib/metasploit_data_models/ip_address/cidr_spec.rb +18 -12
  142. data/spec/lib/metasploit_data_models/ip_address/range_spec.rb +4 -6
  143. data/spec/lib/metasploit_data_models/match/child_spec.rb +2 -4
  144. data/spec/lib/metasploit_data_models/match/parent_spec.rb +4 -6
  145. data/spec/lib/metasploit_data_models/version_spec.rb +3 -139
  146. data/spec/lib/metasploit_data_models_spec.rb +4 -0
  147. data/spec/spec_helper.rb +86 -12
  148. data/spec/support/shared/examples/mdm/module/detail/does_not_support_stance_with_mtype.rb +2 -2
  149. data/spec/support/shared/examples/mdm/module/detail/supports_stance_with_mtype.rb +4 -4
  150. data/spec/support/shared/examples/metasploit_data_models/search/operation/ipaddress/match.rb +2 -2
  151. data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_children.rb +5 -5
  152. data/spec/support/shared/examples/metasploit_data_models/search/visitor/includes/visit/with_metasploit_model_search_operation_base.rb +5 -5
  153. data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_equality.rb +3 -3
  154. data/spec/support/shared/examples/metasploit_data_models/search/visitor/where/visit/with_metasploit_model_search_group_base.rb +7 -6
  155. metadata +74 -14
  156. data/app/models/metasploit_data_models/automatic_exploitation.rb +0 -16
  157. data/lib/tasks/yard.rake +0 -33
@@ -1,4 +1,24 @@
1
+ # Joins a {Mdm::Module::Detail} and {Mdm::Ref} indirectly through the {Mdm::Module::Detail#refname} matching {#module},
2
+ # {Mdm::Module::Detail#mtype} matching {#mtype}, and {Mdm::Ref#name} matching {#ref}.
1
3
  class Mdm::ModRef < ActiveRecord::Base
2
-
4
+ #
5
+ # Attributes
6
+ #
7
+
8
+ # @!attribute module
9
+ # An {Mdm::Module::Detail#refname}.
10
+ #
11
+ # @return [String]
12
+
13
+ # @!attribute mtype
14
+ # An {Mdm::Module::Detail#mtype}.
15
+ #
16
+ # @return [String]
17
+
18
+ # @!attribute ref
19
+ # An {Mdm::Ref#name}.
20
+ #
21
+ # @return [String]
22
+
3
23
  Metasploit::Concern.run(self)
4
24
  end
@@ -1,3 +1,8 @@
1
+ # Actions that auxiliary or post Metasploit Modules can perform. Actions are used to select subcommand-like behavior
2
+ # implemented by the same Metasploit Nodule. The semantics of a given action are specific to a given
3
+ # {Mdm::Module::Detail Metasploit Module}: if two {Mdm::Module::Detail Metasploit Modules} have
4
+ # {Mdm::Module::Action actions} with the same {Mdm::Module::Action#name name}, no similarity should be assumed between
5
+ # those two {Mdm::Module::Action actions} or {Mdm::Module::Detail Metasploit Modules}.
1
6
  class Mdm::Module::Action < ActiveRecord::Base
2
7
  self.table_name = 'module_actions'
3
8
 
@@ -5,8 +10,18 @@ class Mdm::Module::Action < ActiveRecord::Base
5
10
  # Associations
6
11
  #
7
12
 
13
+ # The Metasploit Module with this action.
8
14
  belongs_to :detail, :class_name => 'Mdm::Module::Detail'
9
15
 
16
+ #
17
+ # Attributes
18
+ #
19
+
20
+ # @!attribute [rw] name
21
+ # The name of this action.
22
+ #
23
+ # @return [String]
24
+
10
25
  #
11
26
  # Validations
12
27
  #
@@ -1,3 +1,4 @@
1
+ # A supported architecture for a given {Mdm::Module::Detail Metasploit Module}
1
2
  class Mdm::Module::Arch < ActiveRecord::Base
2
3
  self.table_name = 'module_archs'
3
4
 
@@ -7,6 +8,15 @@ class Mdm::Module::Arch < ActiveRecord::Base
7
8
 
8
9
  belongs_to :detail, :class_name => 'Mdm::Module::Detail'
9
10
 
11
+ #
12
+ # Attributes
13
+ #
14
+
15
+ # @!attribute name
16
+ # The architecture abbreviation, such as `'x86'`
17
+ #
18
+ # @return [String]
19
+
10
20
  #
11
21
  # Validations
12
22
  #
@@ -1,3 +1,4 @@
1
+ # The {#email} and {#name} of an author of a {#detail Metasploit Module}.
1
2
  class Mdm::Module::Author < ActiveRecord::Base
2
3
  self.table_name = 'module_authors'
3
4
 
@@ -5,8 +6,23 @@ class Mdm::Module::Author < ActiveRecord::Base
5
6
  # Associations
6
7
  #
7
8
 
9
+ # The authored Metasploit Module.
8
10
  belongs_to :detail, :class_name => 'Mdm::Module::Detail'
9
-
11
+
12
+ #
13
+ # Attributes
14
+ #
15
+
16
+ # @!attribute email
17
+ # The email address of the author.
18
+ #
19
+ # @return [String]
20
+
21
+ # @!attribute name
22
+ # The name of the author.
23
+ #
24
+ # @return [String]
25
+
10
26
  #
11
27
  # Validations
12
28
  #
@@ -1,3 +1,6 @@
1
+ # @deprecated Never populated by metasploit-framework.
2
+ #
3
+ # Module mixed into a {#detail Metasploit Module}.
1
4
  class Mdm::Module::Mixin < ActiveRecord::Base
2
5
  self.table_name = 'module_mixins'
3
6
 
@@ -5,8 +8,18 @@ class Mdm::Module::Mixin < ActiveRecord::Base
5
8
  # Associations
6
9
  #
7
10
 
11
+ # Metasploit Module the {#name named} `Module` was mixed in.
8
12
  belongs_to :detail, :class_name => 'Mdm::Module::Detail'
9
13
 
14
+ #
15
+ # Attributes
16
+ #
17
+
18
+ # @!attribute name
19
+ # The `Module#name` of the mixed in `Module`.
20
+ #
21
+ # @return [String]
22
+
10
23
  #
11
24
  # Validation
12
25
  #
@@ -1,3 +1,4 @@
1
+ # {#name Platform} on which the {#detail Metasploit Module} can run.
1
2
  class Mdm::Module::Platform < ActiveRecord::Base
2
3
  self.table_name = 'module_platforms'
3
4
 
@@ -5,8 +6,18 @@ class Mdm::Module::Platform < ActiveRecord::Base
5
6
  # Associations
6
7
  #
7
8
 
9
+ # The Metasploit Module that can run on the {#name named} platform.
8
10
  belongs_to :detail, :class_name => 'Mdm::Module::Detail'
9
11
 
12
+ #
13
+ # Attributes
14
+ #
15
+
16
+ # @!attribute name
17
+ # The name of the platform.
18
+ #
19
+ # @return [String]
20
+
10
21
  #
11
22
  # Validations
12
23
  #
@@ -1,3 +1,5 @@
1
+ # A potential target for a {Mdm::Module::Detail exploit Metasploit Module}. Targets can change options including
2
+ # offsets for ROP chains to tune an exploit to work with different system libraries and versions.
1
3
  class Mdm::Module::Target < ActiveRecord::Base
2
4
  self.table_name = 'module_targets'
3
5
 
@@ -5,8 +7,24 @@ class Mdm::Module::Target < ActiveRecord::Base
5
7
  # Associations
6
8
  #
7
9
 
10
+ # Exploit Metasploit Module with the {#name named} target at the given {#index}.
8
11
  belongs_to :detail, :class_name => 'Mdm::Module::Detail'
9
12
 
13
+ #
14
+ # Attributes
15
+ #
16
+
17
+ # @!attribute index
18
+ # The index of this target in the {#detail exploit Metasploit Module}'s list of targets. The index is used for
19
+ # target selection.
20
+ #
21
+ # @return [Integer]
22
+
23
+ # @!attribute name
24
+ # The name of this target.
25
+ #
26
+ # @return [String]
27
+
10
28
  #
11
29
  # Validators
12
30
  #
@@ -1,24 +1,95 @@
1
+ # A connection to Nexpose from Metasploit.
1
2
  class Mdm::NexposeConsole < ActiveRecord::Base
2
3
 
3
4
  #
4
5
  # Associations
5
6
  #
6
7
 
7
- # @!attribute vuln_details
8
- # Details for vulnerabilities supplied by this Nexpose console.
9
- #
10
- # @return [ActiveRecord::Relation<Mdm::VulnDetail>]
8
+ # Details for vulnerabilities supplied by this Nexpose console.
11
9
  has_many :vuln_details,
12
10
  class_name: 'Mdm::VulnDetail',
13
11
  foreign_key: :nx_console_id,
14
12
  inverse_of: :nexpose_console
15
13
 
14
+ #
15
+ # Attributes
16
+ #
17
+
18
+ # @!attribute address
19
+ # Address on which Nexpose is running.
20
+ #
21
+ # @return [String]
22
+
23
+ # @!attribute cert
24
+ # @return [String]
25
+
26
+ # @!attribute created_at
27
+ # When this Nexpose console was created.
28
+ #
29
+ # @return [DateTime]
30
+
31
+ # @!attribute enabled
32
+ # Whether metasploit tried to connect to this Nexpose console.
33
+ #
34
+ # @return [false] is not allowed to connect.
35
+ # @return [true] is allowed to connect.
36
+
37
+ # @!attribute name
38
+ # Name of this Nexpose console to differentiate from other Nexpose consoles.
39
+ #
40
+ # @return [String]
41
+
42
+ # @!attribute owner
43
+ # {Mdm::User#username Name of user} that setup this console.
44
+ #
45
+ # @return [String]
46
+ # @todo https://www.pivotaltracker.com/story/show/52413415
47
+
48
+ # @!attribute password
49
+ # Password used to authenticate to Nexpose.
50
+ #
51
+ # @return [String]
52
+ # @todo https://www.pivotaltracker.com/story/show/52414551
53
+
54
+ # @!attribute port
55
+ # Port on {#address} that Nexpose is running.
56
+ #
57
+ # @return [Integer]
58
+
59
+ # @!attribute status
60
+ # Status of the connection to Nexpose.
61
+ #
62
+ # @return [String]
63
+
64
+ # @!attribute updated_at
65
+ # The last time this Nexpose console was updated.
66
+ #
67
+ # @return [DateTime]
68
+
69
+ # @!attribute username
70
+ # Username used to authenticate to Nexpose.
71
+ #
72
+ # @return [String]
73
+
74
+ # @!attribute version
75
+ # The version of Nexpose. Used to handle protocol difference in different versions of Nexpose.
76
+ #
77
+ # @return [String]
78
+
79
+ #
80
+ # Callbacks
81
+ #
82
+
16
83
  before_save :strip_protocol
17
84
 
18
85
  #
19
86
  # Serializations
20
87
  #
21
88
 
89
+ # @!attribute [rw] cached_sites
90
+ # List of sites known to Nexpose.
91
+ #
92
+ # @return [Array<String>] Array of site names.
22
93
  serialize :cached_sites, MetasploitDataModels::Base64Serializer.new
23
94
 
24
95
  #
@@ -31,6 +102,13 @@ class Mdm::NexposeConsole < ActiveRecord::Base
31
102
  validates :port, :numericality => { :only_integer => true }, :inclusion => {:in => 1..65535}
32
103
  validates :username, :presence => true
33
104
 
105
+ #
106
+ # Instance Methdos
107
+ #
108
+
109
+ # Strips '`http://`' or `'https://'` from {#address}.
110
+ #
111
+ # @return [void]
34
112
  def strip_protocol
35
113
  self.address.gsub!(/^http(s)*:\/\//i,'')
36
114
  end
@@ -1,7 +1,43 @@
1
+ # User settings.
1
2
  class Mdm::Profile < ActiveRecord::Base
3
+ #
4
+ # Attributes
5
+ #
6
+
7
+ # @!attribute active
8
+ # Whether this is the currently active profile.
9
+ #
10
+ # @return [true] if this is the active profile.
11
+ # @return [false] if this profile is inactive and another profile is active.
12
+
13
+ # @!attribute created_at
14
+ # When this profile was created.
15
+ #
16
+ # @return [DateTime]
17
+
18
+ # @!attribute name
19
+ # Name of this profile to distinguish it from other profiles.
20
+ #
21
+ # @return [String]
22
+
23
+ # @!attribute owner
24
+ # Owner of this profile.
25
+ #
26
+ # @return ['<system>'] System-wide profile for all users.
27
+ # @return [String] Name of user that uses this profile.
28
+
29
+ # @!attribute updated_at
30
+ # The last time this profile was updated.
31
+ #
32
+ # @return [DateTime]
33
+
2
34
  #
3
35
  # Serializations
4
36
  #
37
+
38
+ # Global settings.
39
+ #
40
+ # @return [Hash]
5
41
  serialize :settings, MetasploitDataModels::Base64Serializer.new
6
42
 
7
43
  Metasploit::Concern.run(self)
@@ -1,16 +1,28 @@
1
+ # Network route that goes through a {#session} to allow accessing IPs on the remote end of the session.
1
2
  class Mdm::Route < ActiveRecord::Base
2
3
 
3
4
  #
4
5
  # Associations
5
6
  #
6
7
 
7
- # @!attribute [rw] session
8
- # The session over which this route traverses.
9
- #
10
- # @return [Mdm::Session]
8
+ # The session over which this route traverses.
11
9
  belongs_to :session,
12
10
  class_name: 'Mdm::Session',
13
11
  inverse_of: :routes
14
12
 
13
+ #
14
+ # Attributes
15
+ #
16
+
17
+ # @!attribute netmask
18
+ # The netmask for this route.
19
+ #
20
+ # @return [String]
21
+
22
+ # @!attribute subnet
23
+ # The subnet for this route.
24
+ #
25
+ # @return [String]
26
+
15
27
  Metasploit::Concern.run(self)
16
28
  end
@@ -1,12 +1,44 @@
1
+ # Events that occurred when using a {#session}.
1
2
  class Mdm::SessionEvent < ActiveRecord::Base
2
3
 
3
4
  #
4
5
  # Associations
5
6
  #
6
7
 
8
+ # The session in which the event occurred.
7
9
  belongs_to :session,
8
10
  class_name: 'Mdm::Session',
9
11
  inverse_of: :events
10
12
 
13
+ # @!attribute command
14
+ # The command that was run through the session that triggered this event.
15
+ #
16
+ # @return [String]
17
+
18
+ # @!attribute created_at
19
+ # When this event occurred.
20
+ #
21
+ # @return [DateTime]
22
+
23
+ # @!attribute etype
24
+ # The type of the event.
25
+ #
26
+ # @return [String]
27
+
28
+ # @!attribute local_path
29
+ # The current local directory when {#command} was run.
30
+ #
31
+ # @return [String]
32
+
33
+ # @!attribute output
34
+ # The {#output} of running {#command}.
35
+ #
36
+ # @return [String]
37
+
38
+ # @!attribute remote_path
39
+ # The current remote directory when {#command} was run.
40
+ #
41
+ # @return [String]
42
+
11
43
  Metasploit::Concern.run(self)
12
44
  end
@@ -1,3 +1,4 @@
1
+ # Tag {#hosts_tags assigned} to {#hosts}. Tags can be used to group together hosts for targeting and reporting.
1
2
  class Mdm::Tag < ActiveRecord::Base
2
3
  include Metasploit::Model::Search
3
4
 
@@ -5,29 +6,66 @@ class Mdm::Tag < ActiveRecord::Base
5
6
  # Associations
6
7
  #
7
8
 
8
- # @!attribute hosts_tags
9
- # Joins {#hosts} to this tag.
10
- #
11
- # @return [ActiveRecord::Relation<Mdm::HostTag>]
9
+ # Joins {#hosts} to this tag.
12
10
  has_many :hosts_tags,
13
11
  class_name: 'Mdm::HostTag',
14
12
  dependent: :destroy,
15
13
  inverse_of: :tag
16
14
 
15
+ # User that created this tag.
17
16
  belongs_to :user,
18
17
  class_name: 'Mdm::User',
19
18
  inverse_of: :tags
20
19
 
21
20
  #
22
- # Through :hosts_tags
21
+ # through: :hosts_tags
23
22
  #
24
23
 
25
- # @!attribute [r] hosts
26
- # Host that are tagged with this tag.
27
- #
28
- # @return [ActiveRecord::Relation<Mdm::Host>]
24
+ # Hosts that are tagged with this tag.
29
25
  has_many :hosts, :through => :hosts_tags, :class_name => 'Mdm::Host'
30
26
 
27
+ #
28
+ # Attributes
29
+ #
30
+
31
+ # @!attribute created_at
32
+ # When this tag was created by {#user}.
33
+ #
34
+ # @return [DateTime]
35
+
36
+ # @!attribute critical
37
+ # Whether this tag represents a critical finding about the {#hosts}.
38
+ #
39
+ # @return [true] this tag is critical.
40
+ # @return [false] this tag is non-critical.
41
+
42
+ # @!attribute desc
43
+ # Longer description of what this tag should be used for or means when applied to a {#hosts host}.
44
+ #
45
+ # @return [String]
46
+
47
+ # @!attribute name
48
+ # The name of the tag. The name is what a user actually enters to tag a {#hosts host}.
49
+ #
50
+ # @return [String]
51
+
52
+ # @!attribute report_detail
53
+ # Whether to include this tag in a report details section.
54
+ #
55
+ # @return [true] include this tag in the report details section.
56
+ # @return [false] do not include this tag in the report details section.
57
+
58
+ # @!attribute report_summary
59
+ # Whether to include this tag in a report summary section.
60
+ #
61
+ # @return [true] include this tag in the report summary section.
62
+ # @return [false] do not include this tag in the report summary section.
63
+
64
+ # @!attribute updated_at
65
+ # The last time this tag was updated.
66
+ #
67
+ # @return [DateTime]
68
+
31
69
  #
32
70
  # Search
33
71
  #
@@ -67,6 +105,7 @@ class Mdm::Tag < ActiveRecord::Base
67
105
  end
68
106
  end
69
107
 
108
+ # (see #name)
70
109
  def to_s
71
110
  name
72
111
  end