This repository has been archived by the owner on Sep 9, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 29
/
install-pyzule.sh
executable file
·104 lines (92 loc) · 4.15 KB
/
install-pyzule.sh
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
#!/bin/bash
ARCH=$(uname -m)
if [[ $ARCH == *"iPhone"* ]] || [[ $ARCH == *"iPad"* ]]; then
OS="iOS"
PATHPREFIX="/var/jb"
PYZULEURL="https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/pyzule-ios.py"
else
OS=$(uname)
PYZULEURL="https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/pyzule.py"
fi
PZ_DIR=${HOME}/.config/pyzule
# check which python we should use
if [ -x "$(command -v python3.12)" ]; then
PYTHON=python3.12
elif [ -x "$(command -v python3)" ]; then
PYTHON=python3
elif [ -x "$(command -v python)" ]; then
PYTHON=python
elif [ ! -x "$(command -v unzip)" ]; then
echo "[!] unzip is not installed."
exit 1
else
echo "[!] couldn't find \"python\" nor \"python3\" installed."
if [ "$OS" == "Linux" ]; then
echo "[*] try \"sudo apt install python3 python3-pip python3-venv\" or \"sudo pacman -S python python-pip\" depending on your distro."
elif [ "$OS" == "iOS" ]; then
echo "[*] try looking for python in your package manager!"
else
echo "[*] for installation instructions, head over to python.org !"
fi
exit 1
fi
mkdir -p ${PZ_DIR}
if [ ! -d ${PZ_DIR}/venv ]; then
echo "[*] installing required pip libraries.."
$PYTHON -m venv ${PZ_DIR}/venv > /dev/null
if [ ! "$OS" == "iOS" ]; then
${PZ_DIR}/venv/bin/pip install -U Pillow orjson requests lief &> /dev/null
fi
elif [ ! "$OS" == "iOS" ] && [ ! -f ${PZ_DIR}/requests_upd ]; then
touch ${PZ_DIR}/requests_upd
echo "[*] installing new dependencies.."
${PZ_DIR}/venv/bin/pip install -U orjson requests &> /dev/null
fi
if [ ! -x "$(command -v ldid)" ]; then
echo "[*] installing ldid.."
sudo curl -so ${PATHPREFIX}/usr/local/bin/ldid https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/deps/ldid_${OS}_$ARCH
sudo chmod +x ${PATHPREFIX}/usr/local/bin/ldid
fi
# ldid error doesnt seem to happen on iOS
if [ ! -x "$(command -v ipsw)" ] && [ "$OS" != "iOS" ]; then
echo "[*] installing ipsw.."
sudo curl -so ${PATHPREFIX}/usr/local/bin/ipsw https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/deps/ipsw_${OS}_$ARCH
sudo chmod +x ${PATHPREFIX}/usr/local/bin/ipsw
fi
# install_name_tool and otool should only be installed here on linux
if [ ! -x "$(command -v otool)" ]; then
echo "[*] installing otool.."
sudo curl -so ${PATHPREFIX}/usr/local/bin/otool https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/deps/otool_$ARCH
sudo chmod +x ${PATHPREFIX}/usr/local/bin/otool
fi
if [ ! -x "$(command -v install_name_tool)" ]; then
echo "[*] installing install_name_tool.."
sudo curl -so ${PATHPREFIX}/usr/local/bin/install_name_tool https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/deps/install_name_tool_$ARCH
sudo chmod +x ${PATHPREFIX}/usr/local/bin/install_name_tool
fi
# lief is used on desktop, insert_dylib on iOS, so fetch that
if [ "$OS" == "iOS" ] && [ ! -x "$(command -v insert_dylib)" ]; then
# this *might* work? should test on both rootful/rootless
echo "[*] installing insert_dylib.."
sudo curl -so ${PATHPREFIX}/usr/local/bin/insert_dylib https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/deps/insert_dylib
sudo chmod +x ${PATHPREFIX}/usr/local/bin/insert_dylib
fi
# create (or update) hidden dir
if [ ! -d ${PZ_DIR}/Orion.framework ]; then
echo "[*] downloading dependencies.."
curl -so /tmp/zxcvbn_dir.zip https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/zxcvbn_dir.zip
unzip -o /tmp/zxcvbn_dir.zip -d ${PZ_DIR} > /dev/null
rm /tmp/zxcvbn_dir.zip
fi
echo "[*] installing pyzule.."
curl -so ~/.config/pyzule/version.json https://raw.githubusercontent.com/asdfzxcvbn/pyzule/main/version.json
sudo rm ${PATHPREFIX}/usr/local/bin/pyzule &> /dev/null # yeah this is totally required leave me alone
sudo curl -so ${PATHPREFIX}/usr/local/bin/pyzule ${PYZULEURL}
if [ "$OS" == "Linux" ]; then
sudo sed -i "1s|.*|#\!${PZ_DIR}/venv/bin/python|" ${PATHPREFIX}/usr/local/bin/pyzule
else
sudo sed -e "1s|.*|#\!${PZ_DIR}/venv/bin/python|" -i "" ${PATHPREFIX}/usr/local/bin/pyzule &> /dev/null # bsd sed is broken asf
fi
echo "[*] fixed interpreter path!"
sudo chmod +x ${PATHPREFIX}/usr/local/bin/pyzule
echo "[*] done!"