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.
22 23 24 |
# File 'lib/nmap/xml/traceroute.rb', line 22 def initialize(node) @node = node end |
Instance Method Details
#each {|hop| ... } ⇒ Traceroute, Enumerator
Parses the traceroute information for the host.
63 64 65 66 67 68 69 70 71 |
# File 'lib/nmap/xml/traceroute.rb', line 63 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.
32 33 34 35 36 |
# File 'lib/nmap/xml/traceroute.rb', line 32 def port @port ||= if @node['port'] @node['port'].to_i end end |
#protocol ⇒ Symbol?
The protocol used for the traceroute.
44 45 46 47 48 |
# File 'lib/nmap/xml/traceroute.rb', line 44 def protocol @protocol ||= if @node['proto'] @node['proto'].to_sym end end |