forked from powenn/AltServer-Linux-PyScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.py
More file actions
108 lines (93 loc) · 6.32 KB
/
run.py
File metadata and controls
108 lines (93 loc) · 6.32 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
# AltServer-Linux Script python edition
# Author of the script : powen
# import
import os
import subprocess
# Check source and permission
DIRPATH=os.path.dirname(os.path.abspath(__file__))
os.chdir(DIRPATH)
print("Checking source")
if not os.path.exists('AltStore.ipa'):
subprocess.run("wget https://github.com/powenn/AltServer-Linux-PyScript/raw/main/AltStore.ipa",shell=True)
if not os.path.exists('main.py'):
subprocess.run("wget https://github.com/powenn/AltServer-Linux-PyScript/raw/main/main.py",shell=True)
if not os.path.exists('ipa'):
subprocess.run("mkdir ipa",shell=True)
if not os.path.exists('saved.txt'):
subprocess.run("touch saved.txt",shell=True)
if subprocess.run('stat AltServer | grep -- "-rw-r--r--"',shell=True) != "" :
subprocess.run("chmod +x AltServer",shell=True)
# Version
LocalVersion=subprocess.check_output("sed -n 1p version",shell=True).decode('utf-8').replace("\n", "")
LatestVersion=subprocess.check_output("curl -Lsk https://github.com/powenn/AltServer-Linux-PyScript/raw/main/version",shell=True).decode('utf-8')
# Help message
HELP="""
#####################################
# Welcome to the AltServer script #
#####################################
ScriptUsage: [OPTION]
OPTIONS
i, --Install AltStore or ipa files
Install AltStore or ipa files to your device
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
For more information: https://github.com/powenn/AltServer-Linux-PyScript
"""
# AltServer icon
Icon="""
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
"
"""
def AltServerIcon() :
subprocess.run(Icon,shell=True)
# Show update avaliable message
def UpdateNotification() :
if LatestVersion != LocalVersion :
print("-------<< UPDATE AVALIABLE >>-------")
def getAnswer(text):
return input(text)
# Start script
AltServerIcon()
print(HELP)
UpdateNotification()
print("Please connect to your device and press Enter to continue")
subprocess.run('read key',shell=True)
subprocess.run('idevicepair pair > /dev/null',shell=True)
subprocess.run('./AltServer &> /dev/null &',shell=True)
RunScript=0
while RunScript==0 :
option=getAnswer("Enter OPTION to continue :")
if option == 'i' : # Install-AltStore-or-ipa-files
subprocess.run('python3 main.py',shell=True)
if option == 'd' : # Restart-Daemon-mode
subprocess.run('killall AltServer',shell=True)
subprocess.run('idevicepair pair',shell=True)
subprocess.run('./AltServer &> /dev/null &',shell=True)
if option == 'e' : # Exit
subprocess.run('killall AltServer',shell=True)
break
if option == 'h' : # Help
AltServerIcon()
print(HELP)
UpdateNotification()
if option == 'u' : # Update
subprocess.run("curl -Lsk 'https://github.com/powenn/AltServer-Linux-PyScript/raw/main/update.py' | python3",shell=True)