forked from cinit/TMoe
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathHookEntry.java
86 lines (76 loc) · 3.07 KB
/
HookEntry.java
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
package cc.ioctl.tmoe.startup;
import com.github.kyuubiran.ezxhelper.init.EzXHelperInit;
import java.util.List;
import cc.ioctl.tmoe.R;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.IXposedHookZygoteInit;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.callbacks.XC_LoadPackage;
public class HookEntry implements IXposedHookLoadPackage, IXposedHookZygoteInit {
private static final List<String> TELEGRAM_CLIENT_PACKAGE_NAME_LIST = List.of(
"org.telegram.messenger",
"org.telegram.messenger.beta",
"org.telegram.plus",
"nekox.messenger",
"com.jasonkhew96.pigeongram",
"app.nicegram",
"xyz.nextalone.nagram",
"xyz.nextalone.nnngram",
"com.xtaolabs.pagergram",
"org.telegram.messenger.web",
"it.octogram.android",
"uz.unnarsx.cherrygram",
"org.telegram.BifToGram",
"ua.itaysonlab.messenger",
"org.forkclient.messenger.beta",
"org.aka.messenger",
"ellipi.messenger",
"me.luvletter.nekox",
"org.nift4.catox",
"icu.ketal.yunigram",
"icu.ketal.yunigram.lspatch",
"icu.ketal.yunigram.beta",
"icu.ketal.yunigram.lspatch.beta",
"org.forkgram.messenger",
"com.blxueya.gugugram",
"com.radolyn.ayugram",
"com.blxueya.gugugramx",
"com.evildayz.code.telegraher",
"com.exteragram.messenger",
"tw.nekomimi.nekogram"
// "top.qwq2333.nullgram" test only remove it before commit
);
private static String sModulePath = null;
@Override
public void handleLoadPackage(XC_LoadPackage.LoadPackageParam lpparam) throws Throwable {
if (R.string.res_inject_success >>> 24 == 0x7f) {
XposedBridge.log("package id must NOT be 0x7f, reject loading...");
return;
}
String packageName = lpparam.packageName;
// check LSPosed dex-obfuscation
Class<?> kXposedBridge = XposedBridge.class;
if (!"de.robv.android.xposed.XposedBridge".equals(kXposedBridge.getName())) {
String className = kXposedBridge.getName();
String pkgName = className.substring(0, className.lastIndexOf('.'));
HybridClassLoader.setObfuscatedXposedApiPackage(pkgName);
}
if (TELEGRAM_CLIENT_PACKAGE_NAME_LIST.contains(packageName)) {
StartupHook.INSTANCE.doInit(lpparam.classLoader);
EzXHelperInit.INSTANCE.initHandleLoadPackage(lpparam);
EzXHelperInit.INSTANCE.setLogTag("TMoe");
}
}
@Override
public void initZygote(StartupParam startupParam) {
EzXHelperInit.INSTANCE.initZygote(startupParam);
sModulePath = startupParam.modulePath;
}
public static String getModulePath() {
String path = sModulePath;
if (path == null) {
throw new IllegalStateException("sModulePath is null");
}
return path;
}
}