-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall_module.py
More file actions
88 lines (76 loc) · 2.86 KB
/
install_module.py
File metadata and controls
88 lines (76 loc) · 2.86 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
#!/usr/bin/env python3
"""
install_module.py -- Download and install LSPosed modules via ADB
Usage: python3 install_module.py --module Hide-My-Applist
python3 install_module.py --url https://github.com/Dr-TSNG/Hide-My-Applist
"""
import subprocess, json, argparse, re, sys
from pathlib import Path
def download_latest_release(repo_url):
"""Download latest release zip from GitHub repo"""
# Extract owner/repo from URL
m = re.search(r'github\.com/([^/]+)/([^/]+)', repo_url)
if not m:
print(f"Invalid GitHub URL: {repo_url}")
return None
owner, repo = m.groups()
# Get latest release
r = subprocess.run(
f'curl -s "https://api.github.com/repos/{owner}/{repo}/releases/latest" | jq -r ".assets[0].browser_download_url"',
shell=True, capture_output=True, text=True
)
url = r.stdout.strip()
if not url or url == "null":
print(f"No releases found for {repo}")
return None
filename = url.split('/')[-1]
print(f" Downloading {filename}...")
subprocess.run(f"curl -# -L -o {filename} {url}", shell=True)
return filename
def adb(cmd):
subprocess.run(f"adb shell {cmd}", shell=True, capture_output=True)
def main():
parser = argparse.ArgumentParser()
parser.add_argument("--module", help="Module name (searches recommended.json)")
parser.add_argument("--url", help="Direct GitHub repo URL")
args = parser.parse_args()
if not args.module and not args.url:
print("Usage: python3 install_module.py --module NAME")
print(" python3 install_module.py --url https://github.com/user/repo")
sys.exit(1)
# Load recommended modules
try:
with open("recommended.json") as f:
recommended = json.load(f)
all_mods = {}
for category in recommended.values():
for mod in category:
all_mods[mod["name"].lower()] = mod["url"]
except FileNotFoundError:
all_mods = {}
if args.module:
url = all_mods.get(args.module.lower())
if not url:
print(f"Module '{args.module}' not found in recommended.json")
sys.exit(1)
else:
url = args.url
print(f"\n📥 Module installer")
print(f" Repo: {url}\n")
# Download
zipfile = download_latest_release(url)
if not zipfile:
sys.exit(1)
# Push to device and install via TWRP
print(f"\n Pushing {zipfile} to device...")
subprocess.run(f"adb push {zipfile} /sdcard/", shell=True)
print("\n ✓ Pushed. Install via:")
print(" 1. Boot to TWRP recovery")
print(f" 2. Install → /sdcard/{zipfile}")
print(" 3. Reboot system")
print("\n Or via Magisk:")
print(" 1. Magisk → Modules → Install from storage")
print(f" 2. Select /sdcard/{zipfile}")
print(" 3. Reboot")
if __name__ == "__main__":
main()