Merge remote-tracking branch 'origin/sandhook' into sandhook
This commit is contained in:
commit
a956dd2a47
|
|
@ -24,7 +24,7 @@ dependencies {
|
|||
compileOnly files("libs/framework-stub.jar")
|
||||
implementation project(':edxp-common')
|
||||
implementation project(':xposed-bridge')
|
||||
implementation 'com.swift.sandhook:hooklib:3.2.8'
|
||||
implementation 'com.swift.sandhook:hooklib:3.3.4'
|
||||
compileOnly project(':dexmaker')
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ public class Router {
|
|||
|
||||
private static volatile AtomicBoolean bootstrapHooked = new AtomicBoolean(false);
|
||||
|
||||
static boolean useSandHook = false;
|
||||
|
||||
public static void prepare(boolean isSystem) {
|
||||
// this flag is needed when loadModules
|
||||
|
|
@ -61,7 +62,7 @@ public class Router {
|
|||
}
|
||||
Router.startBootstrapHook(isSystem);
|
||||
XposedInit.initForZygote(isSystem);
|
||||
SandHookConfig.compiler = !isSystem;
|
||||
//SandHookConfig.compiler = !isSystem;
|
||||
} catch (Throwable t) {
|
||||
Utils.logE("error during Xposed initialization", t);
|
||||
XposedBridge.disableHooks = true;
|
||||
|
|
@ -81,18 +82,46 @@ public class Router {
|
|||
Utils.logD("startBootstrapHook starts: isSystem = " + isSystem);
|
||||
ClassLoader classLoader = XposedBridge.BOOTCLASSLOADER;
|
||||
if (isSystem) {
|
||||
XposedCompat.addHookers(classLoader, SysBootstrapHookInfo.hookItems);
|
||||
if (useSandHook) {
|
||||
XposedCompat.addHookers(classLoader, SysBootstrapHookInfo.hookItems);
|
||||
} else {
|
||||
HookMain.doHookDefault(
|
||||
Router.class.getClassLoader(),
|
||||
classLoader,
|
||||
SysBootstrapHookInfo.class.getName());
|
||||
}
|
||||
} else {
|
||||
XposedCompat.addHookers(classLoader, AppBootstrapHookInfo.hookItems);
|
||||
if (useSandHook) {
|
||||
XposedCompat.addHookers(classLoader, AppBootstrapHookInfo.hookItems);
|
||||
} else {
|
||||
HookMain.doHookDefault(
|
||||
Router.class.getClassLoader(),
|
||||
classLoader,
|
||||
AppBootstrapHookInfo.class.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void startSystemServerHook() {
|
||||
XposedCompat.addHookers(SystemMainHooker.systemServerCL, SysInnerHookInfo.hookItems);
|
||||
if (useSandHook) {
|
||||
XposedCompat.addHookers(SystemMainHooker.systemServerCL, SysInnerHookInfo.hookItems);
|
||||
} else {
|
||||
HookMain.doHookDefault(
|
||||
Router.class.getClassLoader(),
|
||||
SystemMainHooker.systemServerCL,
|
||||
SysInnerHookInfo.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public static void startWorkAroundHook() {
|
||||
XposedCompat.addHookers(XposedBridge.BOOTCLASSLOADER, WorkAroundHookInfo.hookItems);
|
||||
if (useSandHook) {
|
||||
XposedCompat.addHookers(XposedBridge.BOOTCLASSLOADER, WorkAroundHookInfo.hookItems);
|
||||
} else {
|
||||
HookMain.doHookDefault(
|
||||
Router.class.getClassLoader(),
|
||||
XposedBridge.BOOTCLASSLOADER,
|
||||
WorkAroundHookInfo.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
public static void onEnterChildProcess() {
|
||||
|
|
|
|||
|
|
@ -314,7 +314,6 @@ public class HookStubManager {
|
|||
try {
|
||||
((XC_MethodHook) snapshot[afterIdx]).callAfterHookedMethod(param);
|
||||
} catch (Throwable t) {
|
||||
XposedBridge.log(t);
|
||||
if (lastThrowable == null)
|
||||
param.setResult(lastResult);
|
||||
else
|
||||
|
|
@ -384,7 +383,6 @@ public class HookStubManager {
|
|||
try {
|
||||
((XC_MethodHook) snapshot[afterIdx]).callAfterHookedMethod(param);
|
||||
} catch (Throwable t) {
|
||||
XposedBridge.log(t);
|
||||
if (lastThrowable == null)
|
||||
param.setResult(lastResult);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
package com.swift.sandhook.xposedcompat.methodgen;
|
||||
|
||||
import android.os.Build;
|
||||
import android.os.Process;
|
||||
import android.os.Trace;
|
||||
|
||||
import com.swift.sandhook.SandHook;
|
||||
import com.swift.sandhook.SandHookConfig;
|
||||
import com.swift.sandhook.annotation.HookMode;
|
||||
import com.swift.sandhook.wrapper.HookWrapper;
|
||||
import com.swift.sandhook.xposedcompat.XposedCompat;
|
||||
import com.swift.sandhook.xposedcompat.hookstub.HookMethodEntity;
|
||||
|
|
@ -124,6 +126,9 @@ public final class SandHookXposedBridge {
|
|||
@Override
|
||||
public void loadLib() {
|
||||
//do it in loadDexAndInit
|
||||
if (SandHookConfig.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
SandHook.setHookMode(HookMode.REPLACE);
|
||||
}
|
||||
}
|
||||
};
|
||||
SandHookConfig.DEBUG = true;
|
||||
|
|
|
|||
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue