-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathactivation.py
More file actions
32 lines (29 loc) · 850 Bytes
/
activation.py
File metadata and controls
32 lines (29 loc) · 850 Bytes
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
import subprocess
def install_key(key: str):
try:
out = subprocess.check_output(
"cscript C:\Windows\System32\slmgr.vbs -ipk " + key,
shell=True,
)
except subprocess.CalledProcessError:
return False
return True
def install_kms(host: str):
try:
out = subprocess.check_output(
"cscript C:\Windows\System32\slmgr.vbs -skms " + host, shell=True
)
out = subprocess.check_output(
"cscript C:\Windows\System32\slmgr.vbs /ato", shell=True
)
except subprocess.CalledProcessError:
return False
return True
def check_expire():
out = subprocess.check_output(
"cscript C:\Windows\System32\slmgr.vbs /xpr",
shell=True,
text=True,
encoding="cp866"
)
return str(out).split(' ')[-2]