class Nmap::Service

Wraps a `service` XML element.

@since 0.6.0

Public Class Methods

new(node) click to toggle source

Creates a new OS object.

@param [Nokogiri::XML::Node] node

The node that contains the OS guessing information.
# File lib/nmap/service.rb, line 19
def initialize(node)
  @node = node
end

Public Instance Methods

confidence() click to toggle source

The confidence score of the service fingerprinting.

@return [Integer]

The confidence score.
# File lib/nmap/service.rb, line 151
def confidence
  @confidence ||= @node.get_attribute('conf').to_i
end
device_type() click to toggle source

The reported device type.

@return [String]

The `devicetype` XML attribute.

@since 0.7.0

# File lib/nmap/service.rb, line 119
def device_type
  @device_type ||= @node['devicetype']
end
extra_info() click to toggle source

The extra information from the service scan.

@return [String]

The `extrainfo` XML attribute.

@since 0.7.0

# File lib/nmap/service.rb, line 85
def extra_info
  @extra_info ||= @node['extrainfo']
end
fingerprint() click to toggle source

The actual fingerprint

@return [String]

The fingerprint

@since 0.7.0

# File lib/nmap/service.rb, line 141
def fingerprint
  @fingerprint ||= @node.get_attribute('servicefp')
end
fingerprint_method() click to toggle source

The fingerprint method used to identify the service.

@return [Symbol]

The fingerprint method.
# File lib/nmap/service.rb, line 129
def fingerprint_method
  @fingerprint_method ||= @node.get_attribute('method').to_sym
end
hostname() click to toggle source

The hostname reported by the service.

@return [String]

The reported hostname.
# File lib/nmap/service.rb, line 95
def hostname
  @hostname ||= @node.get_attribute('hostname')
end
name() click to toggle source

The name of the service.

@return [String]

The service name.
# File lib/nmap/service.rb, line 29
def name
  @name ||= @node.get_attribute('name')
end
os_type() click to toggle source

The reported OS type.

@return [String]

The `ostype` XML attribute.

@since 0.7.0

# File lib/nmap/service.rb, line 107
def os_type
  @os_type ||= @node['ostype']
end
product() click to toggle source

The product of the service.

@return [String]

The product name.
# File lib/nmap/service.rb, line 63
def product
  @product ||= @node.get_attribute('product')
end
protocol() click to toggle source

The application protocol used by the service.

@return [String]

The `proto` XML attribute.

@since 0.7.0

# File lib/nmap/service.rb, line 53
def protocol
  @protocol ||= @node['proto']
end
ssl?() click to toggle source

Determines if the service requires SSL.

@return [Boolean]

Checks whether the `tunnel` XML attribute is `ssl`.

@since 0.7.0

# File lib/nmap/service.rb, line 41
def ssl?
  (@ssl ||= @node['tunnel']) == 'ssl'
end
to_s() click to toggle source

Converts the service to a String.

@return [String]

String containing {#product} and {#version}, or {#name}.
# File lib/nmap/service.rb, line 161
def to_s
  if (product && version)
    "#{product} #{version}"
  else
    name
  end
end
version() click to toggle source

The version of the service.

@return [String]

The service version.
# File lib/nmap/service.rb, line 73
def version
  @version ||= @node.get_attribute('version')
end