class Nmap::Traceroute
Wraps the `trace` XML
element.
@since 0.7.0
Public Class Methods
new(node)
click to toggle source
Creates a new traceroute.
@param [Nokogiri::XML::Element] node
The `trace` XML element.
# File lib/nmap/traceroute.rb, line 19 def initialize(node) @node = node end
Public Instance Methods
each() { |hop| ... }
click to toggle source
Parses the traceroute information for the host.
@yield [hop]
Each hop to the host.
@yieldparam [Hop] hop
A hop to the host.
@return [Traceroute, Enumerator]
The traceroute. If no block was given, an enumerator will be returned.
# File lib/nmap/traceroute.rb, line 60 def each return enum_for(__method__) unless block_given? @node.xpath('hop').each do |hop| yield Hop.new(hop['ipaddr'],hop['host'],hop['ttl'],hop['rtt']) end return self end
port()
click to toggle source
The port used for the traceroute.
@return [Integer, nil]
The `port` XML attribute.
# File lib/nmap/traceroute.rb, line 29 def port @port ||= if @node['port'] @node['port'].to_i end end
protocol()
click to toggle source
The protocol used for the traceroute.
@return [Symbol, nil]
The `proto` XML element.
# File lib/nmap/traceroute.rb, line 41 def protocol @protocol ||= if @node['proto'] @node['proto'].to_sym end end