2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/guess_os/type/macos.rb', line 2
def self.guess(host)
conn = GuessOS::Conn.new(host)
command = "sw_vers | grep ProductName"
conn.exec(command)
identified = conn.ok && conn.last_output.include?("Mac OS")
return GuessOS::OS.unkown unless identified
command = "sw_vers | grep ProductVersion"
conn.exec(command)
output = conn.last_output
items = output.split
type = :macos
name = "Mac OS #{items[2].split(".").first}"
desc = output
GuessOS::OS.new(type, name, desc)
end
|