Class: Mdm::Service
- Inherits:
-
ApplicationRecord
- Object
- ApplicationRecord
- Mdm::Service
- Includes:
- Metasploit::Model::Search
- Defined in:
- app/models/mdm/service.rb
Overview
A service, such as an ssh server or web server, running on a #host.
Constant Summary collapse
- PROTOS =
Valid values for #proto.
%w{tcp udp}
- STATES =
Valid values for #state.
['open', 'closed', 'filtered', 'unknown']
Instance Attribute Summary collapse
-
#creds ⇒ ActiveRecord::Relation<Mdm::Cred>
Credentials gathered from this service.
-
#exploit_attempts ⇒ ActiveRecord::Relation<Mdm::ExploitAttempt>
Exploit attempts against this service.
- #exploited_hosts ⇒ Array<Mdm::ExploitHost>
-
#host ⇒ Mdm::Host
The host on which this service runs.
- #info ⇒ String
-
#loots ⇒ ActiveRecord::Relation<Mdm::Loot>
Loot gathers from this service.
-
#name ⇒ String
The name of the service.
-
#notes ⇒ ActiveRecord::Relation<Mdm::Note>
Notes about this service.
-
#port ⇒ Integer
The port on which this service runs on the #host.
-
#proto ⇒ String
The protocol used by this service.
-
#state ⇒ String
Whether this service is opened, closed, filtered, or in an unknown state.
-
#task_services ⇒ Array<Mdm::TaskService>
Details about what Tasks touched this service.
-
#tasks ⇒ Array<Mdm::Task>
Tasks that touched this service.
-
#vulns ⇒ ActiveRecord::Relation<Mdm::Vuln>
Vulnerabilities found in this service.
-
#web_forms ⇒ Array<Mdm::WebForm>
readonly
Form in the #web_sites on top of this service.
-
#web_pages ⇒ Array<Mdm::WebPages>
readonly
Web pages in the #web_sites on top of this service.
-
#web_sites ⇒ ActiveRecord::Relation<Mdm::WebSite>
Web sites running on top of this service.
-
#web_vulns ⇒ Array<Mdm::WebVuln>
readonly
Vulnerabilities found in the #web_sites on top of this service.
Class Method Summary collapse
-
.proto_set ⇒ Set<String>
Set of searchable values for #proto.
Instance Method Summary collapse
-
#normalize_host_os ⇒ void
Normalizes the host operating system whenever #info has changed.
Instance Attribute Details
#creds ⇒ ActiveRecord::Relation<Mdm::Cred>
Credentials gathered from this service.
23 24 25 26 |
# File 'app/models/mdm/service.rb', line 23 has_many :creds, class_name: 'Mdm::Cred', dependent: :destroy, inverse_of: :service |
#exploit_attempts ⇒ ActiveRecord::Relation<Mdm::ExploitAttempt>
Exploit attempts against this service.
32 33 34 35 |
# File 'app/models/mdm/service.rb', line 32 has_many :exploit_attempts, class_name: 'Mdm::ExploitAttempt', dependent: :destroy, inverse_of: :service |
#exploited_hosts ⇒ Array<Mdm::ExploitHost>
MSP-2732
40 41 42 43 |
# File 'app/models/mdm/service.rb', line 40 has_many :exploited_hosts, class_name: 'Mdm::ExploitedHost', dependent: :destroy, inverse_of: :service |
#host ⇒ Mdm::Host
The host on which this service runs.
49 50 51 52 |
# File 'app/models/mdm/service.rb', line 49 belongs_to :host, class_name: 'Mdm::Host', counter_cache: :service_count, inverse_of: :services |
#info ⇒ String
|
# File 'app/models/mdm/service.rb', line 135
|
#loots ⇒ ActiveRecord::Relation<Mdm::Loot>
Loot gathers from this service.
58 59 60 61 |
# File 'app/models/mdm/service.rb', line 58 has_many :loots, class_name: 'Mdm::Loot', dependent: :destroy, inverse_of: :service |
#name ⇒ String
The name of the service.
|
# File 'app/models/mdm/service.rb', line 145
|
#notes ⇒ ActiveRecord::Relation<Mdm::Note>
Notes about this service.
67 68 69 70 |
# File 'app/models/mdm/service.rb', line 67 has_many :notes, class_name: 'Mdm::Note', dependent: :destroy, inverse_of: :service |
#port ⇒ Integer
The port on which this service runs on the #host.
|
# File 'app/models/mdm/service.rb', line 140
|
#proto ⇒ String
The protocol used by this service
|
# File 'app/models/mdm/service.rb', line 150
|
#state ⇒ String
Whether this service is opened, closed, filtered, or in an unknown state.
|
# File 'app/models/mdm/service.rb', line 155
|
#task_services ⇒ Array<Mdm::TaskService>
Details about what Tasks touched this service
76 77 78 79 |
# File 'app/models/mdm/service.rb', line 76 has_many :task_services, class_name: 'Mdm::TaskService', dependent: :destroy, inverse_of: :service |
#tasks ⇒ Array<Mdm::Task>
Tasks that touched this service
107 |
# File 'app/models/mdm/service.rb', line 107 has_many :tasks, :through => :task_services, :class_name => 'Mdm::Task' |
#vulns ⇒ ActiveRecord::Relation<Mdm::Vuln>
Vulnerabilities found in this service.
85 86 87 88 |
# File 'app/models/mdm/service.rb', line 85 has_many :vulns, class_name: 'Mdm::Vuln', dependent: :destroy, inverse_of: :service |
#web_forms ⇒ Array<Mdm::WebForm> (readonly)
Form in the #web_sites on top of this service.
123 |
# File 'app/models/mdm/service.rb', line 123 has_many :web_forms, :through => :web_sites, :class_name => 'Mdm::WebForm' |
#web_pages ⇒ Array<Mdm::WebPages> (readonly)
Web pages in the #web_sites on top of this service.
117 |
# File 'app/models/mdm/service.rb', line 117 has_many :web_pages, :through => :web_sites, :class_name => 'Mdm::WebPage' |
#web_sites ⇒ ActiveRecord::Relation<Mdm::WebSite>
Web sites running on top of this service.
94 95 96 97 |
# File 'app/models/mdm/service.rb', line 94 has_many :web_sites, class_name: 'Mdm::WebSite', dependent: :destroy, inverse_of: :service |
#web_vulns ⇒ Array<Mdm::WebVuln> (readonly)
Vulnerabilities found in the #web_sites on top of this service.
129 |
# File 'app/models/mdm/service.rb', line 129 has_many :web_vulns, :through => :web_sites, :class_name => 'Mdm::WebVuln' |
Class Method Details
Instance Method Details
#normalize_host_os ⇒ void
This method returns an undefined value.
Normalizes the host operating system whenever #info has changed.
260 261 262 263 264 |
# File 'app/models/mdm/service.rb', line 260 def normalize_host_os if saved_change_to_info? && host.workspace.present? && !host.workspace.import_fingerprint host.normalize_os end end |