package com.xiaojianbang.xposed;
import android.util.Log;
import de.robv.android.xposed.IXposedHookLoadPackage;
import de.robv.android.xposed.XposedHelpers;
import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
public class Hook implements IXposedHookLoadPackage {
public void handleLoadPackage(LoadPackageParam loadPackageParam) throws Throwable {
Log.d("xiaojianbang", "Hooking......");
if (loadPackageParam.packageName.equals("com.xiaojianbang.xposeddemo")) {
Class clazz = XposedHelpers.findClass("com.xiaojianbang.xposeddemo.Demo", loadPackageParam.classLoader);
Log.d("xiaojianbang", clazz.getName());
Method[] md = clazz.getDeclaredMethods();
for (Method method : md) {
Log.d("xiaojianbang", method.toString());
}
Field[] fd = clazz.getDeclaredFields();
for (Field field : fd) {
Log.d("xiaojianbang", field.toString());
}
Log.d("xiaojianbang", "====================================");
Class[] cls = clazz.getDeclaredClasses();
for (int i = 0; i < fd.length; i++) {
Log.d("xiaojianbang", cls[i].getName());
Method[] mds = cls[i].getDeclaredMethods();
for (Method method2 : mds) {
Log.d("xiaojianbang", method2.toString());
}
Field[] fds = cls[i].getDeclaredFields();
for (Field field2 : fds) {
Log.d("xiaojianbang", field2.toString());
}
}
}
}
}
原文地址:https://blog.51cto.com/haidragon/2396902