forked from fetchcord/FetchCord
-
Notifications
You must be signed in to change notification settings - Fork 1
/
mactesting.py
44 lines (43 loc) · 936 Bytes
/
mactesting.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import os
packages = os.popen("ls -l /Applications | wc -l").read()
appsp = "Applications: " + packages
ver = os.popen("sw_vers -productVersion").read()
uptime = os.popen("sysctl -n kern.boottime").read()
product = os.popen("sysctl -n hw.model").read()
kernel = os.popen("uname -r").read()
ruptime = uptime.split()
devicetype = "none"
macver = "none"
bigicon = "none"
uptime = ruptime[3]
print (uptime[:-1])
def iHsiera():
global bigicon
bigicon = "hsierria"
def iMojave():
global bigicon
bigicon = "mojave"
def iCatilina():
global bigicon
bigicon = "catilina"
versions ={
"10.13": iHsiera,
"10.14": iMojave,
"10.15": iCatilina
}
def laporp():
global devicetype
if product[0:7] == "MacBook":
devicetype = "laptop"
else:
devicetype = "desktop"
def findver():
global bigicon
try:
versions[ver[0:5]]()
except IndexError:
bigicon = "bigslurp"
except KeyError:
print("Unsupported MacOS version")
findver()
laporp()