package com.xiaojianbang.xposed;
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XC_MethodHook;
import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
import de.robv.android.xposed.XposedBridge;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
public class Hook implements IXposedHookLoadPackage {
public void handleLoadPackage(LoadPackageParam loadPackageParam) throws Throwable {
Log.d("dajianbang", "Hooking......");
if (loadPackageParam.packageName.equals("com.xiaojianbang.xposeddemo")) {
XposedHelpers.findAndHookMethod(ClassLoader.class, "loadClass", new Object[]{String.class, new XC_MethodHook() {
/* access modifiers changed from: protected */
public void afterHookedMethod(MethodHookParam param) throws Throwable {
Class clazz = (Class) param.getResult();
String clazzName = clazz.getName();
StringBuilder sb = new StringBuilder();
sb.append("LoadClass: ");
sb.append(clazzName);
Log.d("dajianbang", sb.toString());
if (clazzName.contains("com.xiaojianbang")) {
Method[] mds = clazz.getDeclaredMethods();
for (int i = 0; i < mds.length; i++) {
final Method md = mds[i];
int mod = mds[i].getModifiers();
if (!Modifier.isAbstract(mod) && !Modifier.isNative(mod) && !Modifier.isInterface(mod)) {
XposedBridge.hookMethod(mds[i], new XC_MethodHook() {
/* access modifiers changed from: protected */
public void beforeHookedMethod(MethodHookParam param) throws Throwable {
if (md.getName().contains("complexParameterFunc")) {
for (Object obj : param.args) {
Log.d("dajianbang", obj.getClass().getName());
}
}
StringBuilder sb = new StringBuilder();
sb.append("Hook Method: ");
sb.append(md.toString());
Log.d("dajianbang", sb.toString());
}
});
}
}
}
}
}});
}
}
}
转载于:https://blog.51cto.com/haidragon/2396903
发布者:全栈程序员-用户IM,转载请注明出处:https://javaforall.cn/100909.html原文链接:https://javaforall.cn
【正版授权,激活自己账号】: Jetbrains全家桶Ide使用,1年售后保障,每天仅需1毛
【官方授权 正版激活】: 官方授权 正版激活 支持Jetbrains家族下所有IDE 使用个人JB账号...