Class: Nmap::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/nmap/service.rb

Overview

Wraps a service XML element.

Since:

  • 0.6.0

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ Service

Creates a new OS object.

Parameters:

  • node (Nokogiri::XML::Node)

    The node that contains the OS guessing information.

Since:

  • 0.6.0



15
16
17
# File 'lib/nmap/service.rb', line 15

def initialize(node)
  @node = node
end

Instance Method Details

#confidenceInteger

The confidence score of the service fingerprinting.

Returns:

  • (Integer)

    The confidence score.

Since:

  • 0.6.0



75
76
77
# File 'lib/nmap/service.rb', line 75

def confidence
  @confidence ||= @node.get_attribute('conf').to_i
end

#fingerprint_methodSymbol

The fingerprint method used to identify the service.

Returns:

  • (Symbol)

    The fingerprint method.

Since:

  • 0.6.0



65
66
67
# File 'lib/nmap/service.rb', line 65

def fingerprint_method
  @fingerprint_method ||= @node.get_attribute('method').to_sym
end

#hostnameString

The hostname reported by the service.

Returns:

  • (String)

    The reported hostname.

Since:

  • 0.6.0



55
56
57
# File 'lib/nmap/service.rb', line 55

def hostname
  @hostname ||= @node.get_attribute('hostname')
end

#nameString Also known as: to_s

The name of the service.

Returns:

  • (String)

    The service name.

Since:

  • 0.6.0



25
26
27
# File 'lib/nmap/service.rb', line 25

def name
  @name ||= @node.get_attribute('name')
end

#productString

The product of the service.

Returns:

  • (String)

    The product name.

Since:

  • 0.6.0



35
36
37
# File 'lib/nmap/service.rb', line 35

def product
  @product ||= @node.get_attribute('product')
end

#versionString

The version of the service.

Returns:

  • (String)

    The service version.

Since:

  • 0.6.0



45
46
47
# File 'lib/nmap/service.rb', line 45

def version
  @version ||= @node.get_attribute('version')
end