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.
20 21 22 |
# File 'lib/nmap/xml/os_class.rb', line 20 def initialize(node) @node = node end |
Instance Method Details
#accuracy ⇒ Integer
The accuracy of the OS class information.
70 71 72 |
# File 'lib/nmap/xml/os_class.rb', line 70 def accuracy @accuracy ||= @node.get_attribute('accuracy').to_i end |
#family ⇒ Symbol?
The OS family.
49 50 51 |
# File 'lib/nmap/xml/os_class.rb', line 49 def family @family ||= @node.get_attribute('osfamily').to_sym end |
#gen ⇒ Symbol?
The OS generation.
58 59 60 61 62 |
# File 'lib/nmap/xml/os_class.rb', line 58 def gen @gen ||= if @node['osgen'] @node['osgen'].to_sym end end |
#to_s ⇒ String
Converts the OS class to a String.
80 81 82 |
# File 'lib/nmap/xml/os_class.rb', line 80 def to_s "#{self.type} #{self.vendor} (#{self.accuracy}%)" end |
#type ⇒ String
The OS type.
29 30 31 32 33 |
# File 'lib/nmap/xml/os_class.rb', line 29 def type @type ||= if @node['type'] @node['type'].to_sym end end |
#vendor ⇒ String
The OS vendor.
40 41 42 |
# File 'lib/nmap/xml/os_class.rb', line 40 def vendor @vendor ||= @node.get_attribute('vendor') end |