This repository was archived by the owner on Sep 7, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·234 lines (206 loc) · 8 KB
/
run.sh
File metadata and controls
executable file
·234 lines (206 loc) · 8 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
#!/bin/bash
# Author of the script : powen
# Check source and permission
cd "$(dirname "$0")"
echo "Checking source"
if [[ ! -e "AltStore.ipa" ]]; then
wget https://github.com/powenn/AltServer-Linux-ShellScript/raw/main/AltStore.ipa
fi
if [[ ! -e "ipa" ]]; then
mkdir ipa
fi
if [[ ! -e "saved.txt" ]]; then
touch saved.txt
fi
if [[ "stat AltServer | grep -rw-r--r--" != "" ]] ; then
chmod +x AltServer
fi
#####
HasExistAccount=$(cat saved.txt)
UDID=$(lsusb -v 2> /dev/null | grep -e "Apple Inc" -A 2 | grep iSerial | awk '{print $3}')
HasExistipa=$(ls ipa)
# Instruction
cat << EOF >help.txt
#####################################
# Welcome to the AltServer script #
#####################################
Usage: [OPTION]
OPTIONS
1, --Install AltStore
Install AltStore to your device
2, --Install ipa
Install ipa in Folder 'ipa',make sure you have put ipa files in the Folder before run this
d, --Restart Daemon mode
Restart Daemon mode to refresh apps or AltStore
e, --Exit
Exit script
h, --Help
Show this message
u, --Update
Update this script or AltServer
EOF
# Print AltServer icon
AltServerIcon() {
printf "\e[49m \e[38;5;73;49m▄▄\e[38;5;66;49m▄\e[38;5;66;48;5;73m▄▄▄▄▄▄▄▄\e[38;5;66;49m▄\e[38;5;73;49m▄▄\e[49m \e[m
\e[49m \e[38;5;73;49m▄\e[38;5;66;48;5;73m▄\e[38;5;66;48;5;66m▄▄▄▄▄▄\e[38;5;67;48;5;66m▄▄\e[38;5;66;48;5;66m▄▄▄▄▄▄\e[38;5;66;48;5;73m▄\e[38;5;73;49m▄\e[49m \e[m
\e[49m \e[38;5;73;49m▄\e[38;5;30;48;5;73m▄\e[38;5;30;48;5;30m▄▄▄▄▄▄\e[38;5;109;48;5;73m▄\e[38;5;109;48;5;109m▄▄▄▄\e[38;5;109;48;5;73m▄\e[38;5;30;48;5;30m▄▄▄▄▄▄\e[38;5;30;48;5;73m▄\e[38;5;73;49m▄\e[49m \e[m
\e[49m \e[38;5;73;49m▄\e[38;5;30;48;5;73m▄\e[38;5;30;48;5;30m▄▄▄▄▄▄\e[38;5;73;48;5;30m▄\e[38;5;73;48;5;73m▄▄▄▄▄▄▄▄\e[38;5;73;48;5;30m▄\e[38;5;30;48;5;30m▄▄▄▄▄▄\e[38;5;30;48;5;73m▄\e[38;5;73;49m▄\e[49m \e[m
\e[49m \e[38;5;30;48;5;73m▄\e[38;5;30;48;5;30m▄▄▄▄▄\e[38;5;73;48;5;30m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;15;48;5;73m▄\e[38;5;15;48;5;15m▄▄\e[38;5;15;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;73;48;5;30m▄\e[38;5;30;48;5;30m▄▄▄▄▄\e[38;5;30;48;5;73m▄\e[49m \e[m
\e[38;5;73;48;5;73m▄\e[38;5;30;48;5;30m▄▄▄\e[38;5;73;48;5;30m▄▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;15;48;5;73m▄\e[38;5;15;48;5;15m▄\e[48;5;15m \e[38;5;15;48;5;15m▄\e[38;5;15;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;73;48;5;30m▄▄\e[38;5;30;48;5;30m▄▄▄\e[38;5;73;48;5;73m▄\e[m
\e[38;5;73;48;5;73m▄\e[38;5;30;48;5;30m▄▄\e[38;5;66;48;5;30m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;15;48;5;73m▄\e[48;5;15m \e[38;5;15;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;66;48;5;30m▄\e[38;5;30;48;5;30m▄▄\e[38;5;73;48;5;73m▄\e[m
\e[38;5;73;48;5;73m▄\e[38;5;30;48;5;30m▄▄\e[38;5;30;48;5;66m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;73;48;5;15m▄\e[48;5;15m \e[38;5;73;48;5;15m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;30;48;5;66m▄\e[38;5;30;48;5;30m▄▄\e[38;5;73;48;5;73m▄\e[m
\e[38;5;73;48;5;73m▄\e[38;5;6;48;5;6m▄▄▄\e[38;5;6;48;5;66m▄\e[38;5;6;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;73;48;5;15m▄\e[38;5;15;48;5;15m▄\e[48;5;15m \e[38;5;15;48;5;15m▄\e[38;5;73;48;5;15m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;6;48;5;73m▄\e[38;5;6;48;5;72m▄\e[38;5;6;48;5;6m▄▄▄\e[38;5;73;48;5;73m▄\e[m
\e[49m \e[38;5;73;48;5;6m▄\e[38;5;6;48;5;6m▄▄▄▄▄\e[38;5;6;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;73;48;5;15m▄\e[38;5;15;48;5;15m▄▄\e[38;5;73;48;5;15m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;6;48;5;73m▄\e[38;5;6;48;5;6m▄▄▄▄▄\e[38;5;73;48;5;6m▄\e[49m \e[m
\e[49m \e[49;38;5;66m▀\e[38;5;67;48;5;6m▄\e[38;5;6;48;5;6m▄▄▄▄▄▄\e[38;5;6;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄▄▄▄▄\e[38;5;6;48;5;73m▄\e[38;5;6;48;5;6m▄▄▄▄▄▄\e[38;5;67;48;5;6m▄\e[49;38;5;66m▀\e[49m \e[m
\e[49m \e[49;38;5;67m▀\e[38;5;66;48;5;6m▄\e[38;5;6;48;5;6m▄▄▄▄▄▄\e[38;5;66;48;5;73m▄\e[38;5;73;48;5;73m▄▄▄▄\e[38;5;66;48;5;73m▄\e[38;5;6;48;5;6m▄▄▄▄▄▄\e[38;5;66;48;5;6m▄\e[49;38;5;67m▀\e[49m \e[m
\e[49m \e[49;38;5;66m▀\e[38;5;66;48;5;6m▄\e[38;5;6;48;5;6m▄▄▄▄▄▄\e[38;5;6;48;5;30m▄▄\e[38;5;6;48;5;6m▄▄▄▄▄▄\e[38;5;66;48;5;6m▄\e[49;38;5;66m▀\e[49m \e[m
\e[49m \e[49;38;5;66m▀▀\e[49;38;5;6m▀\e[38;5;66;48;5;6m▄▄▄▄▄▄▄▄\e[49;38;5;6m▀\e[49;38;5;66m▀▀\e[49m \e[m
";
}
# Check if there exists saved account
# Ask if want to use saved account
AskAccount() {
if [[ "$HasExistAccount" != "" ]]; then
echo "Do you want to use saved Account ? [y/n]"
read reply
case "$reply" in
[yY][eE][sS]|[yY] )
echo "Which account you want to use ? "
UseExistAccount=1
nl saved.txt
echo "please enter the number "
read number
ExistID=$(sed -n "$number"p saved.txt | cut -d , -f 1)
ExistPasswd=$(sed -n "$number"p saved.txt | cut -d , -f 2)
;;
[nN][oO]|[nN] )
UseExistAccount=0
;;
esac
fi
if [[ "$HasExistAccount" == "" ]]; then
UseExistAccount=0
fi
if [[ $UseExistAccount = 0 ]]; then
echo "Please provide your AppleID"
read AppleID
echo "Please provide the password of AppleID"
read password
fi
}
# Execute AltServer
# Check if this account existed before
AltServer() {
if [[ $UseExistAccount = 1 ]]; then
./AltServer -u ${UDID} -a $ExistID -p $ExistPasswd $PATH
fi
if [[ $UseExistAccount = 0 ]]; then
./AltServer -u ${UDID} -a $AppleID -p $password $PATH
fi
if [[ "$CheckAccount" == "" ]] ; then
RunScript=1
fi
if [[ "$CheckAccount" != "" ]] ; then
exit
fi
}
# Check if there exists ipa files in ipa folder
# Ask which ipa want to install
ipaCheck() {
if [[ "$HasExistipa" != "" ]]; then
echo "Please provide the number of ipa "
echo "$HasExistipa" > ipaList.txt
nl ipaList.txt
read ipanumber
Existipa=$(sed -n "$ipanumber"p ipaList.txt )
else
echo "There is no ipa filess in ipa folder "
exit
fi
}
# Ask to save the new account
SaveAcccount() {
echo "Do you want to save this Account ? [y/n]"
read ans
case "$ans" in
[yY][eE][sS]|[yY] )
echo "$Account" >> saved.txt
echo "saved"
exit
;;
[nN][oO]|[nN] )
exit
;;
esac
}
# Start script
AltServerIcon
cat help.txt
echo "Please connect to your device and press Enter to continue"
read key
idevicepair pair > /dev/null
./AltServer &> /dev/null &
RunScript=0
while [ $RunScript = 0 ] ; do
echo "Enter OPTION to continue"
read option
case "$option" in
1|--Install-AltStore )
killall AltServer
for job in `jobs -p`
do
wait $job
done
idevicepair pair
AskAccount
Account=$AppleID,$password
CheckAccount=$(grep $Account saved.txt)
PATH=./AltStore.ipa
AltServer
;;
2|--Install-ipa )
killall AltServer
for job in `jobs -p`
do
wait $job
done
idevicepair pair
ipaCheck
AskAccount
Account=$AppleID,$password
CheckAccount=$(grep $Account saved.txt)
PATH=./ipa/$Existipa
AltServer
;;
d|--Restart-Daemon-mode )
killall AltServer
for job in `jobs -p`
do
wait $job
done
idevicepair pair
./AltServer &> /dev/null &
;;
e|--Exit )
killall AltServer
exit
;;
h|--Help )
AltServerIcon
cat help.txt
;;
u|--Update )
curl -Lsk 'https://github.com/powenn/AltServer-Linux-ShellScript/raw/main/update.sh' | bash
chmod +x *.sh
if [[ -e "AltServer" ]]; then
chmod +x AltServer
fi
if [[ -e "AltServerDaemon" ]]; then
chmod +x AltServerDaemon
fi
;;
esac
done
while [ $RunScript = 1 ] ; do
SaveAcccount
done