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.
60 61 62 63 64 65 66 67 68 |
# 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 ⇒ Integer?
The port used for the traceroute.
29 30 31 32 33 |
# File 'lib/nmap/traceroute.rb', line 29 def port @port ||= if @node['port'] @node['port'].to_i end end |
#protocol ⇒ Symbol?
The protocol used for the traceroute.
41 42 43 44 45 |
# File 'lib/nmap/traceroute.rb', line 41 def protocol @protocol ||= if @node['proto'] @node['proto'].to_sym end end |