Commit d7dcb659 authored by swift_gan's avatar swift_gan

add passApiCheck Method

parent 818f4cbc
......@@ -35,6 +35,7 @@ public class MyApp extends Application {
}
SandHook.disableVMInline();
SandHook.passApiCheck();
try {
SandHook.addHookClass(JniHooker.class,
......
package com.swift.sandhook;
import android.os.Build;
import android.util.Log;
import com.swift.sandhook.annotation.HookMode;
import com.swift.sandhook.utils.ReflectionUtils;
import com.swift.sandhook.utils.Unsafe;
import com.swift.sandhook.wrapper.HookErrorException;
import com.swift.sandhook.wrapper.HookWrapper;
......@@ -295,6 +293,10 @@ public class SandHook {
}
}
public static boolean passApiCheck() {
return ReflectionUtils.passApiCheck();
}
private static native boolean initNative(int sdk, boolean debug);
public static native void setHookMode(int hookMode);
......
......@@ -33,6 +33,16 @@ public class ReflectionUtils {
}
}
public static boolean passApiCheck() {
try {
addReflectionWhiteList("Landroid/", "Lcom/android/");
return true;
} catch (Throwable throwable) {
throwable.printStackTrace();
return false;
}
}
//methidSigs like Lcom/swift/sandhook/utils/ReflectionUtils;->vmRuntime:java/lang/Object; (from hidden policy list)
public static void addReflectionWhiteList(String... memberSigs) throws Throwable {
addWhiteListMethod.invoke(vmRuntime, new Object[] {memberSigs});
......
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