| package com.sky.xposeddemo; |
| |
| import android.app.Application; |
| import android.content.Context; |
| import android.util.Log; |
| |
| import de.robv.android.xposed.IXposedHookLoadPackage; |
| import de.robv.android.xposed.XC_MethodHook; |
| import de.robv.android.xposed.XC_MethodReplacement; |
| import de.robv.android.xposed.XposedBridge; |
| import de.robv.android.xposed.XposedHelpers; |
| import de.robv.android.xposed.callbacks.XC_LoadPackage; |
| |
| public class Hook implements IXposedHookLoadPackage { |
| @Override |
| public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable { |
| if(!loadPackageParam.packageName.equals("com.zj.wuaipojie")){ |
| return; |
| } |
| |
| @Override |
| protected void beforeHookedMethod (MethodHookParam param) throws Throwable { |
| super.beforeHookedMethod (param); |
| Log.d ("zj2595",param.args [0].toString ()); |
| XposedBridge.log (param.args [0].toString ()); |
| String a = "pt 嘿嘿嘿参数修改成功"; |
| param.args [0] = a; |
| Log.d ("zj2595",param.args [0].toString ()); |
| } |
| @Override |
| protected void afterHookedMethod (MethodHookParam param) throws Throwable { |
| super.afterHookedMethod (param); |
| Log.d ("zj2595",param.getResult ().toString ()); |
| param.setResult ("返回值修改成功哇哈哈"); |
| } |
| });*/ |
| |
| XposedBridge.hookAllMethods(a, "complexParameterFunc", new XC_MethodHook() { |
| @Override |
| protected void beforeHookedMethod(MethodHookParam param) throws Throwable { |
| super.beforeHookedMethod(param); |
| Log.d("zj2595",param.args[0].toString()); |
| |
| } |
| });*/ |
| |
| XposedBridge.hookAllMethods (a,"repleaceFunc",new XC_MethodReplacement () { |
| @Override |
| protected Object replaceHookedMethod (MethodHookParam methodHookParam) throws Throwable { |
| return "";// 可用于去弹窗 |
| } |
| });*/ |
| XposedHelpers.findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() { |
| @Override |
| protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
| Context context = (Context) param.args[0]; |
| ClassLoader classLoader = context.getClassLoader(); |
| XposedHelpers.findAndHookMethod("com.zj.wuaipojie.Demo", loadPackageParam.classLoader, "a", String.class, new XC_MethodHook() { |
| @Override |
| protected void beforeHookedMethod(MethodHookParam param) throws Throwable { |
| super.beforeHookedMethod(param); |
| Log.d("zj2595",param.args[0].toString()); |
| XposedBridge.log(param.args[0].toString()); |
| String a = "pt嘿嘿嘿参数修改成功"; |
| param.args[0] = a; |
| Log.d("zj2595",param.args[0].toString()); |
| } |
| @Override |
| protected void afterHookedMethod(MethodHookParam param) throws Throwable { |
| super.afterHookedMethod(param); |
| Log.d("zj2595",param.getResult().toString()); |
| param.setResult("返回值修改成功哇哈哈"); |
| } |
| }); |
| |
| } |
| }); |
| |
| |
| |
| } |
| } |