Class: Nmap::Traceroute
- Inherits:
-
Object
- Object
- Nmap::Traceroute
- Includes:
- Enumerable
- Defined in:
- lib/nmap/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.
19 20 21 |
# File 'lib/nmap/traceroute.rb', line 19 def initialize(node) @node = node end |
Instance Method Details
#each {|hop| ... } ⇒ Traceroute, Enumerator
Parses the traceroute information for the host.
56 57 58 59 60 61 62 63 64 |
# File 'lib/nmap/traceroute.rb', line 56 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.
29 30 31 |
# File 'lib/nmap/traceroute.rb', line 29 def port @port ||= @node['port'].to_i end |
#protocol ⇒ Symbol
The protocol used for the traceroute.
39 40 41 |
# File 'lib/nmap/traceroute.rb', line 39 def protocol @protocol ||= @node['proto'].to_sym end |