Commit 7a2d02e3 authored by swift_gan's avatar swift_gan Committed by ganyao114

tweak for edxp

parent 1799d815
......@@ -17,10 +17,15 @@ public class PendingHookHandler {
static {
//init native hook
canUsePendingHook = SandHook.initForPendingHook();
if (!SandHookConfig.edxpEnv) {
canUsePendingHook = SandHook.initForPendingHook();
}
}
public static boolean canWork() {
if (SandHookConfig.edxpEnv) {
return true;
}
return canUsePendingHook && SandHook.canGetObject() && !SandHookConfig.DEBUG;
}
......@@ -37,6 +42,10 @@ public class PendingHookHandler {
if (clazz_ptr == 0)
return;
Class clazz = (Class) SandHook.getObject(clazz_ptr);
onClassInit(clazz);
}
public static void onClassInit(Class clazz) {
if (clazz == null)
return;
Vector<HookWrapper.HookEntity> entities = pendingHooks.get(clazz);
......
......@@ -336,7 +336,7 @@ public class SandHook {
if (SandHookConfig.SDK_INT < Build.VERSION_CODES.N)
return false;
try {
File profile = new File("/data/misc/profiles/cur/" + SandHookConfig.curUse + "/" + selfPackageName + "/primary.prof");
File profile = new File("/data/misc/profiles/cur/" + SandHookConfig.curUser + "/" + selfPackageName + "/primary.prof");
if (!profile.getParentFile().exists()) return false;
try {
profile.delete();
......
......@@ -13,8 +13,10 @@ public class SandHookConfig {
//Enable compile with jit
public volatile static boolean compiler = true;
public volatile static ClassLoader initClassLoader;
public volatile static int curUse = 0;
public volatile static int curUser = 0;
public volatile static boolean delayHook = true;
//is for edxposed?
public volatile static boolean edxpEnv = false;
public volatile static String libSandHookPath;
public volatile static LibLoader libLoader = new LibLoader() {
......@@ -29,7 +31,6 @@ public class SandHookConfig {
}
};
public interface LibLoader {
void loadLib();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment