Sha256: c4179d2cd44a7cb5b6b08a173d1d68a2c12a1d3d306f51657d430a487e73eddc

Contents?: true

Size: 1.45 KB

Versions: 1

Compression:

Stored size: 1.45 KB

Contents

module Nmap
  #
  # Wraps a `service` XML element.
  #
  # @since 0.6.0
  #
  class Service

    #
    # Creates a new OS object.
    #
    # @param [Nokogiri::XML::Node] node
    #   The node that contains the OS guessing information.
    #
    def initialize(node)
      @node = node
    end

    #
    # The name of the service.
    #
    # @return [String]
    #   The service name.
    #
    def name
      @name ||= @node.get_attribute('name')
    end

    #
    # The product of the service.
    #
    # @return [String]
    #   The product name.
    #
    def product
      @product ||= @node.get_attribute('product')
    end

    #
    # The version of the service.
    #
    # @return [String]
    #   The service version.
    #
    def version
      @version ||= @node.get_attribute('version')
    end

    #
    # The hostname reported by the service.
    #
    # @return [String]
    #   The reported hostname.
    #
    def hostname
      @hostname ||= @node.get_attribute('hostname')
    end

    #
    # The fingerprint method used to identify the service.
    #
    # @return [Symbol]
    #   The fingerprint method.
    #
    def fingerprint_method
      @fingerprint_method ||= @node.get_attribute('method').to_sym
    end

    #
    # The confidence score of the service fingerprinting.
    #
    # @return [Integer]
    #   The confidence score.
    #
    def confidence
      @confidence ||= @node.get_attribute('conf').to_i
    end

    alias to_s name

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-nmap-0.6.0 lib/nmap/service.rb