module Nmap::CPE

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

[CPE]: nmap.org/book/output-formats-cpe.html

@since 0.7.0

Public Instance Methods

cpe() click to toggle source

Parses each Common Platform Enumeration (CPE) String.

@return [Array<URL>]

The CPE URLs.
# File lib/nmap/cpe.rb, line 41
def cpe
  each_cpe.to_a
end
each_cpe() { |parse| ... } click to toggle source

Parses each Common Platform Enumeration (CPE) String.

@yield [cpe]

Passes each CPE URL to the given block.

@yieldparam [URL] cpe

The CPE URL.

@return [Enumerator]

If no block is given, an enumerator object will be returned.
# File lib/nmap/cpe.rb, line 25
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