forked from asdfzxcvbn/pyzule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
install-pyzule.py
61 lines (52 loc) · 2.86 KB
/
install-pyzule.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
from requests import get
from sys import executable
from os import path as osp
from subprocess import run
from zipfile import ZipFile
from os import makedirs, remove
DEP_DIR = osp.expanduser("~/.zxcvbn")
DEPS = {
"CydiaSubstrate.framework": "https://cdn.discordapp.com/attachments/1105232452529700985/1135672920916623420/MiniSubstrate.zip",
"Substitute.framework": "https://cdn.discordapp.com/attachments/1105232452529700985/1135084740941193326/Substitute-2.3.22.g3e9b535-framework.zip",
"Cephei.framework": "https://cdn.discordapp.com/attachments/1130557037361770526/1130557602951069816/Cephei.framework.zip",
"CepheiUI.framework": "https://cdn.discordapp.com/attachments/1130557037361770526/1130557964185501778/CepheiUI.framework.zip",
"CepheiPrefs.framework": "https://cdn.discordapp.com/attachments/1130557037361770526/1130558249532407968/CepheiPrefs.framework.zip",
"libhdev.framework": "https://cdn.discordapp.com/attachments/1130557037361770526/1148308065586786435/libhdev.framework.zip",
"librocketbootstrap.dylib": "https://cdn.discordapp.com/attachments/1105635370885992458/1125588473466851328/librocketbootstrap.dylib",
"libmryipc.dylib": "https://cdn.discordapp.com/attachments/1105635370885992458/1120562207458070568/libmryipc.dylib"
}
makedirs(DEP_DIR, exist_ok=True)
def download(dep, link, ftype="z"):
dl = get(link).content
if ftype == "z":
with open((fp := osp.join(DEP_DIR, dep) + ".zip"), "wb") as f:
f.write(dl)
with ZipFile(fp) as zf:
zf.extractall(DEP_DIR)
remove(fp)
else:
with open(osp.join(DEP_DIR, dep), "wb") as f:
f.write(dl)
# `tuple()` avoids a RuntimeError: dictionary changed size during iteration
for dep in tuple(DEPS.keys()):
if osp.exists(osp.join(DEP_DIR, dep)):
del DEPS[dep]
# to get minified substrate
if not osp.exists(osp.join(DEP_DIR, ".redownloaded_substrate_jul_31_2023")):
DEPS["CydiaSubstrate.framework"] = "https://cdn.discordapp.com/attachments/1105232452529700985/1135672920916623420/MiniSubstrate.zip"
open(osp.join(DEP_DIR, ".redownloaded_substrate_jul_31_2023"), "a").close()
for dependency, link in DEPS.items():
print(f"[*] downloading {dependency}..")
if dependency.endswith("k"):
download(dependency, link)
else:
download(dependency, link, "d")
print("[*] installing pyzule..")
with open((pz_path := osp.join(DEP_DIR, "pyzule.py")), "w") as f:
content_req = get("https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/pyzule.py").text.split("\n")
content_req[0] = f"#!{executable}"
print("[*] fixed executable path!")
f.write("\n".join(content_req))
print("[?] if prompted, enter your sudo password to finish installation")
run(["sudo", "-p", "[<] ", "mv", pz_path, "/usr/local/bin/pyzule"], check=True)
run(["sudo", "-p", "[<] ", "chmod", "+x", "/usr/local/bin/pyzule"], check=True)