Class: Nmap::XML::OSClass
- Inherits:
-
Object
- Object
- Nmap::XML::OSClass
- Includes:
- CPE
- Defined in:
- lib/nmap/xml/os_class.rb
Overview
Represents an OS class.
Instance Method Summary collapse
-
#accuracy ⇒ Integer
The accuracy of the OS class information.
-
#family ⇒ Symbol?
The OS family.
-
#gen ⇒ Symbol?
The OS generation.
-
#initialize(node) ⇒ OSClass
constructor
Initializes the OS.
-
#to_s ⇒ String
Converts the OS class to a String.
-
#type ⇒ String
The OS type.
-
#vendor ⇒ String
The OS vendor.
Methods included from CPE
Constructor Details
#initialize(node) ⇒ OSClass
Initializes the OS.
22 23 24 |
# File 'lib/nmap/xml/os_class.rb', line 22 def initialize(node) @node = node end |
Instance Method Details
#accuracy ⇒ Integer
The accuracy of the OS class information.
72 73 74 |
# File 'lib/nmap/xml/os_class.rb', line 72 def accuracy @accuracy ||= @node.get_attribute('accuracy').to_i end |
#family ⇒ Symbol?
The OS family.
51 52 53 |
# File 'lib/nmap/xml/os_class.rb', line 51 def family @family ||= @node.get_attribute('osfamily').to_sym end |
#gen ⇒ Symbol?
The OS generation.
60 61 62 63 64 |
# File 'lib/nmap/xml/os_class.rb', line 60 def gen @gen ||= if @node['osgen'] @node['osgen'].to_sym end end |
#to_s ⇒ String
Converts the OS class to a String.
82 83 84 |
# File 'lib/nmap/xml/os_class.rb', line 82 def to_s "#{self.type} #{self.vendor} (#{self.accuracy}%)" end |
#type ⇒ String
The OS type.
31 32 33 34 35 |
# File 'lib/nmap/xml/os_class.rb', line 31 def type @type ||= if @node['type'] @node['type'].to_sym end end |
#vendor ⇒ String
The OS vendor.
42 43 44 |
# File 'lib/nmap/xml/os_class.rb', line 42 def vendor @vendor ||= @node.get_attribute('vendor') end |