Module: Nmap::XML::CPE

Included in:
OSClass, Service
Defined in:
lib/nmap/xml/cpe.rb,
lib/nmap/xml/cpe/url.rb

Overview

Mixins that adds methods for parsing Common Platform Enumeration (CPE) information.

Since:

  • 1.0.0

Defined Under Namespace

Classes: URL

Instance Method Summary collapse

Instance Method Details

#cpeArray<URL>

Parses each Common Platform Enumeration (CPE) String.

Returns:

  • (Array<URL>)

    The CPE URLs.

Since:

  • 1.0.0



44
45
46
# File 'lib/nmap/xml/cpe.rb', line 44

def cpe
  each_cpe.to_a
end

#each_cpe {|cpe| ... } ⇒ Enumerator

Parses each Common Platform Enumeration (CPE) String.

Yields:

  • (cpe)

    Passes each CPE URL to the given block.

Yield Parameters:

  • cpe (URL)

    The CPE URL.

Returns:

  • (Enumerator)

    If no block is given, an enumerator object will be returned.

Since:

  • 1.0.0



28
29
30
31
32
33
34
35
36
# File 'lib/nmap/xml/cpe.rb', line 28

def each_cpe
  return enum_for(__method__) unless block_given?

  @node.xpath('cpe').each do |cpe|
    yield URL.parse(cpe.inner_text)
  end

  return self
end