Method: Nmap::XML#each_down_host

Defined in:
lib/nmap/xml.rb

#each_down_host {|host| ... } ⇒ XML, Enumerator

Parses the hosts that were found to be down during the scan.

Yields:

  • (host)

    Each host will be passed to a given block.

Yield Parameters:

  • host (Host)

    A down host in the scan.

Returns:

  • (XML, Enumerator)

    The XML parser. If no block was given, an enumerator object will be returned.

Since:

  • 0.8.0


347
348
349
350
351
352
353
354
355
# File 'lib/nmap/xml.rb', line 347

def each_down_host
  return enum_for(__method__) unless block_given?

  @doc.xpath("/nmaprun/host[status[@state='down']]").each do |host|
    yield Host.new(host)
  end

  return self
end