一、主要代码
package com.bucuo.a20210908; import android.app.Application; import android.content.Context; import android.util.Log; import de.robv.android.xposed.IXposedHookLoadPackage; import de.robv.android.xposed.XposedBridge; import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam; import static de.robv.android.xposed.XposedHelpers.findAndHookMethod; import de.robv.android.xposed.IXposedHookLoadPackage; import de.robv.android.xposed.XC_MethodHook; import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam; public class hook implements IXposedHookLoadPackage { public void handleLoadPackage(final LoadPackageParam loadPackageParam) throws Throwable { Log.d("逆向有你", "hook成功"); if(!loadPackageParam.packageName.equals("com.dodonew.online")) return; Log.d("逆向有你","hooking....."); findAndHookMethod(Application.class,"attach", Context.class, new XC_MethodHook() { protected void beforeHookedMethod(MethodHookParam param) throws Throwable { } protected void afterHookedMethod(MethodHookParam param) throws Throwable { ClassLoader cl= ((Context)param.args[0]).getClassLoader(); Class<?> hookclass=null; try { hookclass=cl.loadClass("com.dodonew.online.http.RequestUtil"); }catch (Exception e){ Log.e("逆向有你","未找到类",e); return; } Log.d("逆向有你","已找到类"); findAndHookMethod(hookclass, "encodeDesMap", String.class, String.class, String.class, new XC_MethodHook() { @Override protected void afterHookedMethod(MethodHookParam param) throws Throwable { String args0 = (String) param.args[0]; String args1 = (String) param.args[1]; String args2 = (String) param.args[2]; Log.d("逆向有你", args0); Log.d("逆向有你", args1); Log.d("逆向有你", args2); } }); } }); } }
二、效果和上节课一样
禁止非法,后果自负