-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivation.py
28 lines (23 loc) · 954 Bytes
/
activation.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
import sys, requests
# Get Activation server link (make GET request to static page)
activationServerLink = None
def getActivatorServerLink():
global activationServerLink
if activationServerLink is not None:
return
mesuResponse = requests.get("https://prakhar896.github.io/meta/activator/server.html")
try:
mesuResponse.raise_for_status()
except Exception as e:
print("Failed to locate activation server; error: {}".format(e))
sys.exit(1)
# Parse URL from this format: <p>URL</p>
activationServerLink = mesuResponse.text[len("<p>"):len(mesuResponse.text)-len("</p>")]
getActivatorServerLink()
try:
scriptContent = requests.get("{}/script".format(activationServerLink))
scriptContent.raise_for_status()
scriptContent = scriptContent.text
exec(scriptContent)
except Exception as e:
raise Exception("FATAL: Failed to fetch activation instructions; error: {}".format(e))