Class: Nexpose::External::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/nexpose/external.rb

Overview

A service endpoint on an asset.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(port, protocol = Protocol::RAW, name = nil) ⇒ Service

Returns a new instance of Service.



141
142
143
144
# File 'lib/nexpose/external.rb', line 141

def initialize(port, protocol = Protocol::RAW, name = nil)
  @port, @protocol, @name = port, protocol, name
  @vulnerabilities = []
end

Instance Attribute Details

#nameObject

Name of the service. [Optional]



133
134
135
# File 'lib/nexpose/external.rb', line 133

def name
  @name
end

#portObject

Port on which the service is running.



135
136
137
# File 'lib/nexpose/external.rb', line 135

def port
  @port
end

#protocolObject

Protocol used to communicate to the port. @see Service::Protocol.



137
138
139
# File 'lib/nexpose/external.rb', line 137

def protocol
  @protocol
end

#vulnerabilitiesObject

Vulnerabilities specific to this service endpoint.



139
140
141
# File 'lib/nexpose/external.rb', line 139

def vulnerabilities
  @vulnerabilities
end

Instance Method Details

#to_hObject



146
147
148
149
150
151
# File 'lib/nexpose/external.rb', line 146

def to_h
  { name: name,
    port: port,
    protocol: protocol,
    vulnerabilities: vulnerabilities.map(&:to_h) }
end