class Nmap::XML::OS
Wraps the ‘os` XML
element.
@since 1.0.0
Public Class Methods
new(node)
click to toggle source
Creates a new OS
object.
@param [Nokogiri::XML::Node] node
The node that contains the OS guessing information.
# File lib/nmap/xml/os.rb, line 21 def initialize(node) @node = node end
Public Instance Methods
classes()
click to toggle source
Parses the OS
class information.
@return [Array<OSClass>]
The OS class information.
# File lib/nmap/xml/os.rb, line 54 def classes each_class.to_a end
each(&block)
click to toggle source
Parses the OS
match information.
@see each_match
# File lib/nmap/xml/os.rb, line 125 def each(&block) each_match(&block) end
each_class() { |os_class| ... }
click to toggle source
Parses the OS
class information.
@yield [class]
Passes each OS class to the given block.
@yieldparam [OSClass] class
The OS class information.
@return [OS, Enumerator]
The OS information. If no block was given, an enumerator object will be returned.
# File lib/nmap/xml/os.rb, line 38 def each_class return enum_for(__method__) unless block_given? @node.xpath("osmatch/osclass").each do |osclass| yield OSClass.new(osclass) end return self end
each_match() { |os_match| ... }
click to toggle source
Parses the OS
match information.
@yield [match]
Passes each OS match to the given block.
@yieldparam [OSMatch] class
The OS match information.
@return [OS, Enumerator]
The OS information. If no block was given, an enumerator object will be returned.
# File lib/nmap/xml/os.rb, line 71 def each_match return enum_for(__method__) unless block_given? @node.xpath("osmatch").each do |osclass| os_match = OSMatch.new( osclass['name'], osclass['accuracy'].to_i ) yield os_match end return self end
fingerprint()
click to toggle source
matches()
click to toggle source
Parses the OS
match information.
@return [Array<OSMatch>]
The OS match information.
# File lib/nmap/xml/os.rb, line 92 def matches each_match.to_a end
ports_used()
click to toggle source
Parses the ports used for guessing the OS
.
@return [Array<Integer>]
The ports used.
# File lib/nmap/xml/os.rb, line 102 def ports_used @ports_used ||= @node.xpath("portused/@portid").map do |port| port.inner_text.to_i end end