Class: Nmap::Service

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

Overview

Wraps a service XML element.

Since:

  • 0.6.0

Instance Method Summary collapse

Methods included from CPE

#cpe, #each_cpe

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



19
20
21
# File 'lib/nmap/service.rb', line 19

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



151
152
153
# File 'lib/nmap/service.rb', line 151

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

#device_typeString

The reported device type.

Returns:

  • (String)

    The devicetype XML attribute.

Since:

  • 0.7.0



119
120
121
# File 'lib/nmap/service.rb', line 119

def device_type
  @device_type ||= @node['devicetype']
end

#extra_infoString

The extra information from the service scan.

Returns:

  • (String)

    The extrainfo XML attribute.

Since:

  • 0.7.0



85
86
87
# File 'lib/nmap/service.rb', line 85

def extra_info
  @extra_info ||= @node['extrainfo']
end

#fingerprintString

The actual fingerprint

Returns:

  • (String)

    The fingerprint

Since:

  • 0.7.0



141
142
143
# File 'lib/nmap/service.rb', line 141

def fingerprint
  @fingerprint ||= @node.get_attribute('servicefp')
end

#fingerprint_methodSymbol

The fingerprint method used to identify the service.

Returns:

  • (Symbol)

    The fingerprint method.

Since:

  • 0.6.0



129
130
131
# File 'lib/nmap/service.rb', line 129

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



95
96
97
# File 'lib/nmap/service.rb', line 95

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



29
30
31
# File 'lib/nmap/service.rb', line 29

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

#os_typeString

The reported OS type.

Returns:

  • (String)

    The ostype XML attribute.

Since:

  • 0.7.0



107
108
109
# File 'lib/nmap/service.rb', line 107

def os_type
  @os_type ||= @node['ostype']
end

#productString

The product of the service.

Returns:

  • (String)

    The product name.

Since:

  • 0.6.0



63
64
65
# File 'lib/nmap/service.rb', line 63

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

#protocolString

The application protocol used by the service.

Returns:

  • (String)

    The proto XML attribute.

Since:

  • 0.7.0



53
54
55
# File 'lib/nmap/service.rb', line 53

def protocol
  @protocol ||= @node['proto']
end

#ssl?Boolean

Determines if the service requires SSL.

Returns:

  • (Boolean)

    Checks whether the tunnel XML attribute is ssl.

Since:

  • 0.7.0



41
42
43
# File 'lib/nmap/service.rb', line 41

def ssl?
  (@ssl ||= @node['tunnel']) == 'ssl'
end

#versionString

The version of the service.

Returns:

  • (String)

    The service version.

Since:

  • 0.6.0



73
74
75
# File 'lib/nmap/service.rb', line 73

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