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.



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

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

Instance Attribute Details

#nameObject

Name of the service. [Optional]



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

def name
  @name
end

#portObject

Port on which the service is running.



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

def port
  @port
end

#protocolObject

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



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

def protocol
  @protocol
end

#vulnerabilitiesObject

Vulnerabilities specific to this service endpoint.



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

def vulnerabilities
  @vulnerabilities
end

Instance Method Details

#to_hObject



152
153
154
155
156
157
# File 'lib/nexpose/external.rb', line 152

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