Class: Nmap::XML::Traceroute
- Inherits:
-
Object
- Object
- Nmap::XML::Traceroute
- Includes:
- Enumerable
- Defined in:
- lib/nmap/xml/traceroute.rb
Overview
Wraps the trace
XML element.
Instance Method Summary collapse
-
#each {|hop| ... } ⇒ Traceroute, Enumerator
Parses the traceroute information for the host.
-
#initialize(node) ⇒ Traceroute
constructor
Creates a new traceroute.
-
#port ⇒ Integer?
The port used for the traceroute.
-
#protocol ⇒ Symbol?
The protocol used for the traceroute.
Constructor Details
#initialize(node) ⇒ Traceroute
Creates a new traceroute.
20 21 22 |
# File 'lib/nmap/xml/traceroute.rb', line 20 def initialize(node) @node = node end |
Instance Method Details
#each {|hop| ... } ⇒ Traceroute, Enumerator
Parses the traceroute information for the host.
61 62 63 64 65 66 67 68 69 |
# File 'lib/nmap/xml/traceroute.rb', line 61 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 ⇒ Integer?
The port used for the traceroute.
30 31 32 33 34 |
# File 'lib/nmap/xml/traceroute.rb', line 30 def port @port ||= if @node['port'] @node['port'].to_i end end |
#protocol ⇒ Symbol?
The protocol used for the traceroute.
42 43 44 45 46 |
# File 'lib/nmap/xml/traceroute.rb', line 42 def protocol @protocol ||= if @node['proto'] @node['proto'].to_sym end end |