参考链接:https://www.cnblogs.com/xiaobaiyey/p/6442417.html
public class EncryptHook implements IXposedHookLoadPackage { public void handleLoadPackage(LoadPackageParam loadPackageParam) throws Throwable { if (!loadPackageParam.packageName.equals("app包名")) { return; } XposedBridge.log("Start hook " + loadPackageParam.packageName); XposedHelpers.findAndHookMethod("com.stub.StubApp", loadPackageParam.classLoader, //com.stub.StubApp 加壳的类 "attachBaseContext", Context.class, new XC_MethodHook() { // attachBaseContext 加壳的方法 @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { super.afterHookedMethod(param); Context context = (Context) param.args[0]; ClassLoader classLoader = context.getClassLoader(); XposedBridge.log("Enter stubApp"); XposedHelpers.findAndHookMethod("com.huijiemanager.utils.t", classLoader, "a", byte[].class, PublicKey.class, new XC_MethodHook() { @Override protected void beforeHookedMethod(MethodHookParam param) throws Throwable { XposedBridge.log("rsa before params: " + new String( (byte[]) param.args[0]) + "," + param.args[1]); } @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { XposedBridge.log("rsa after params: " + new String( (byte[]) param.args[0]) + "," + param.args[1]); } }); } }); } }注:反编译的代码不一定准确,逆向的时候最好对每个关键函数都挂上钩子,查看参数是否正确。
附上xposedAPI文档:https://api.xposed.info/reference/packages.html