class Nmap::Service
Wraps a `service` XML
element.
@since 0.6.0
Public Class Methods
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
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
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
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
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
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
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
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
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
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
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
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
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
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