精华内容
下载资源
问答
  • xposed api-82

    2018-04-17 20:54:25
    xposed 开发必须的api 包含两个文件api-82.jar 和 api-82-source.jar
  • xposed.apk && XposedBridgeApi-82.jar hook 工具
  • xposed-api-82-sources

    2018-09-07 15:53:36
    xposed-api-82-sources resources 资源文件 和xposed-api-82放到同一个文件夹下
  • Xposed

    2021-02-27 18:09:15
    xposed开发环境搭建 创建一个无Activity的项目,切换到Project视图,在app目录下创建一个lib目录 ...provided files('lib/api-82.jar') 修改AndroidManifest.xml <meta-data android:name="xposedmodule

    xposed开发环境搭建

    创建一个无Activity的项目,切换到Project视图,在app目录下创建一个lib目录
    在这里插入图片描述
    将xposed的jar添加到lib目录下,选中这个jar包,然后右击,将这个添加为库(编译的时候,不需要打包这个jar包)
    在build.gradle的dependencies中添加一行

    provided files('lib/api-82.jar')
    

    在这里插入图片描述
    修改AndroidManifest.xml

    <meta-data
        android:name="xposedmodule"
        android:value="true" />
    <meta-data
        android:name="xposeddescription"
        android:value="my name is xiaojianbang" />
    <meta-data
        android:name="xposedminversion"
        android:value="53" />
    

    在这里插入图片描述
    然后创建一个类Hook,输入内容

    public class Hook implements IXposedHookLoadPackage{
    
        // Xposed是一个全局的Hook
        // 如果对一个app进行过滤,需要 参数XC_LoadPackage.LoadPackageParam loadPackageParam进行判断
        @Override
        public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
            Log.d("showme","hook start...");
    
            if(!loadPackageParam.packageName.equals("com.xingin.xls")) return;
            
        }
    }
    

    在main目录下创建一个assets目录,创建一个文本文件 xposed_init
    指定入口类:在其中输入 Hook类的完整路径名(包名.类名)
    在这里插入图片描述
    点击Build
    在这里插入图片描述
    找到生成的apk,进行安装
    在这里插入图片描述
    安装好之后,激活模块,然后重启
    在这里插入图片描述

    hook构造函数

    ClassLoader classLoader = loadPackageParam.classLoader;
    Class StudentClass = classLoader.loadClass("com.showme.xposedhook01.Student");
    XposedHelpers.findAndHookConstructor(StudentClass, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            XposedBridge.log("com.showme.xposedhook01.Student() is called!!beforeHookedMethod");
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            XposedBridge.log("com.showme.xposedhook01.Student() is called!!afterHookedMethod");
        }
    });
    
    
    XposedHelpers.findAndHookConstructor(StudentClass, String.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            java.lang.Object[] argsobjarray = param.args;
            String name = (String) argsobjarray[0];
            XposedBridge.log("com.showme.xposedhook01.Student(String) is called!!beforeHookedMethod--" + name);
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            XposedBridge.log("com.showme.xposedhook01.Student(String) is called!!afterHookedMethod");
        }
    });
    
    
    XposedHelpers.findAndHookConstructor("com.showme.xposedhook01.Student", loadPackageParam.classLoader, String.class, String.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            java.lang.Object[] argsobjarray = param.args;
            String name = (String) argsobjarray[0];
            String id = (String) argsobjarray[1];
            XposedBridge.log("com.showme.xposedhook01.Student(String,String) is called!!beforeHookedMethod--" + name + "---" + id);
    
        }
    });
    
    
    ClassLoader pathClassLoader= loadPackageParam.classLoader;
    final Class stuClass=pathClassLoader.loadClass("com.showme.xposedhook01.Student");
    XposedHelpers.setStaticObjectField(stuClass,"teacher","teacher888");
    String teachername2= (String) XposedHelpers.getStaticObjectField(stuClass,"teacher");
    
    
    
    XposedHelpers.findAndHookConstructor(StudentClass, String.class, String.class, int.class,String.class,String.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            java.lang.Object[] argsobjarray = param.args;
            String name = (String) argsobjarray[0];
            String id = (String) argsobjarray[1];
            int age = (int) (argsobjarray[2]);
            argsobjarray[1] = "2050";
            argsobjarray[2] = 100;
    
            String teacher= (String) argsobjarray[3];
            String nickname= (String) argsobjarray[4];
    
            XposedBridge.log("com.showme.xposedhook01.Student(String,String) is called!!beforeHookedMethod--" + name + "---" + id + "--" + age+"---"+teacher+"---"+nickname);
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
    
            Object thisobj = param.thisObject;
    
        /*       Field nicknameField=stuClass.getDeclaredField("nickname");
            XposedBridge.log(stuClass+"--nicknameField->"+nicknameField);
            nicknameField.setAccessible(true);
            nicknameField.set(thisobj,"bear");*/
    
            XposedHelpers.setObjectField(thisobj,"nickname","chick");
    
            Object returnobj = param.getResult();
            XposedBridge.log(thisobj + "---" + returnobj);
            XposedBridge.log("com.showme.xposedhook01.Student(String,String,int) is called!!afterHookedMethod");
        }
    });
    

    hook系统类,DexClassLoader,应用加载了哪些插件

    XposedHelpers.findAndHookConstructor(DexClassLoader.class, String.class, String.class, String.class, ClassLoader.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            Object array[]=param.args;
            String dexpath= (String) array[0];
            String optimizedDirectory= (String) array[1];
            String librarySearchPath= (String) array[2];
            XposedBridge.log("DexClassLoader beforeHookedMethod:"+dexpath+"---"+optimizedDirectory+"---"+librarySearchPath);
    
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
    
            DexClassLoader dexClassLoader= (DexClassLoader) param.thisObject;
            XposedBridge.log("DexClassLoader afterHookedMethod:"+dexClassLoader);
        }
    });
    

    hook属性:使用java反射和Xposed的API

    ClassLoader classLoader = loadPackageParam.classLoader;
    Class StudentClass = classLoader.loadClass("com.showme.xposedhook.Student");
    
    // java反射
    Field teacherField=stuClass.getDeclaredField("teacher");
    teacherField.setAccessible(true);
    teacherField.set(null,"teacher666");
    String teachername1= (String) teacherField.get(null);
    XposedBridge.log("teacherField->"+teachername1);
    
    // Xposed中的实现和java反射一样,但是默认调用了 setAccessible(true);
    XposedHelpers.setStaticObjectField(stuClass,"teacher","teacher888");
    String teachername2= (String) XposedHelpers.getStaticObjectField(stuClass,"teacher");
    
    
    @Override
    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
        super.afterHookedMethod(param);
    
        Object thisobj = param.thisObject;
        XposedHelpers.setObjectField(thisobj,"nickname","chick");
    
        Object returnobj = param.getResult();
        XposedBridge.log(thisobj + "---" + returnobj);
    }
    

    hook一般方法

    ClassLoader classLoader = loadPackageParam.classLoader;
    Class StuClass = classLoader.loadClass("com.showme.xposedhook01.Student");
    
    // 一般java函数的hook 
    XposedHelpers.findAndHookMethod("com.showme.xposedhook01.Student", loadPackageParam.classLoader, "privatefunc", String.class, int.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            Object[] objectarray = param.args;
            String arg0 = (String) objectarray[0];
            int arg1 = (int) objectarray[1];
            XposedBridge.log("beforeHookedMethod11 privatefunc->arg0:" + arg0 + "---arg1:" + arg1);
    
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
    
            String result = (String) param.getResult();
            XposedBridge.log("afterHookedMethod11 privatefunc->result:" + result);
    
        }
    });
    
    // 内部类中的函数hook
    Class personClass = XposedHelpers.findClass("com.showme.xposedhook01.Student$person", loadPackageParam.classLoader);
    XposedHelpers.findAndHookMethod(personClass, "getpersonname", String.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            XposedBridge.log("beforeHookedMethod getpersonname->" + param.args[0]);
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            XposedBridge.log("afterHookedMethod getpersonname->" + param.getResult());
        }
    });
    
    // 匿名内部类函数的hook - 匿名内部类总会有一个类名的,用那个类名就行了
    
    // 类中JNI函数的hook - 和普通函数一样
    

    主动调用函数

    // java 反射的方式
    ClassLoader classLoader = loadPackageParam.classLoader;
    Class StuClass = classLoader.loadClass("com.showme.xposedhook01.Student");
    Method publicstaticfunc_method = StuClass.getDeclaredMethod("publicstaticfunc", String.class, int.class);
    publicstaticfunc_method.invoke(null, "InvokedByXposed", 100);
    
    // Xposed 中的API
    //            public static java.lang.Object callMethod(java.lang.Object obj, java.lang.String methodName, java.lang.Object... args) { /* compiled code */ }
    //
    //            public static java.lang.Object callMethod(java.lang.Object obj, java.lang.String methodName, java.lang.Class<?>[] parameterTypes, java.lang.Object... args) { /* compiled code */ }
    //
    //            public static java.lang.Object callStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Object... args)
    //
    //            public static java.lang.Object callStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Class<?>[] parameterTypes, java.lang.Object... args)
    
    java.lang.Class<?>[] parameterTypes = {String.class, int.class};
    
    XposedHelpers.callStaticMethod(StuClass, "publicstaticfunc", parameterTypes, "publicstaticfunc is called by XposedHelpers.callStaticMethod11", 100);
    XposedHelpers.callStaticMethod(StuClass, "publicstaticfunc", "publicstaticfunc is called by XposedHelpers.callStaticMethod22", 200);
    
    XposedHelpers.callStaticMethod(StuClass, "privatestaticfunc", parameterTypes, "privatestaticfunc is called by XposedHelpers.callStaticMethod11", 400);
    XposedHelpers.callStaticMethod(StuClass, "privatestaticfunc", "privatestaticfunc is called by XposedHelpers.callStaticMethod22", 300);
    
    
    Method privatestaticfunc_method = StuClass.getDeclaredMethod("privatestaticfunc", String.class, int.class);
    privatestaticfunc_method.setAccessible(true);
    String result = (String) privatestaticfunc_method.invoke(null, "privatestaticfuncIsInvokedByXposed", 200);
    
    
    //            public static java.lang.Object callMethod(java.lang.Object obj, java.lang.String methodName, java.lang.Object... args) { /* compiled code */ }
    //
    //            public static java.lang.Object callMethod(java.lang.Object obj, java.lang.String methodName, java.lang.Class<?>[] parameterTypes, java.lang.Object... args) { /* compiled code */ }
    
    //            public static java.lang.Object newInstance(java.lang.Class<?> clazz, java.lang.Object... args) { /* compiled code */ }
    //
    //            public static java.lang.Object newInstance(java.lang.Class<?> clazz, java.lang.Class<?>[] parameterTypes, java.lang.Object... args) { /* compiled code */ }
    
    
    Object StuObjByXposed = XposedHelpers.newInstance(StuClass, "StuObjByXposed.newInstance", "500");
    String result1 = (String) XposedHelpers.callMethod(StuObjByXposed, "publicfunc", "publicfunc is called by XposedHelpers.callMethod", 125);
    XposedBridge.log("publicfunc XposedHelpers.callMethod result->" + result1);
    
    XposedHelpers.callMethod(StuObjByXposed, "privatefunc", "privatefunc is called by XposedHelpers.callMethod", 130);
    
    
    
    
    //Student cstudent = new Student("xiaohua", "2020");
    XposedHelpers.findAndHookConstructor(StuClass, String.class, String.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            XposedBridge.log("Student(String,String) is called beforeHookedMethod");
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            XposedBridge.log("Student(String,String) is called afterHookedMethod");
            Object cstudent=param.thisObject;
            XposedHelpers.callMethod(cstudent,"publicfunc","publicfunc is called XposedHelpers.findAndHookConstructor",666);
            XposedHelpers.callMethod(cstudent,"privatefunc","privatefunc is called XposedHelpers.findAndHookConstructor",888);
        }
    });
    
    
    //            public String getNickname() {
    //                return nickname;
    //            }
    
    XposedHelpers.findAndHookMethod(StuClass, "getNickname", new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            Object obj=param.thisObject;
            XposedHelpers.callMethod(obj,"publicfunc","beforeHookedMethod publicfunc is called XposedHelpers.callMethod",444);
            XposedHelpers.callMethod(obj,"privatefunc","beforeHookedMethod privatefunc is called XposedHelpers.callMethod",333);
    
            XposedBridge.log("getNickname is called beforeHookedMethod->"+obj);
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            Object obj=param.thisObject;
            XposedHelpers.callMethod(obj,"publicfunc","afterHookedMethod publicfunc is called XposedHelpers.callMethod",222);
            XposedHelpers.callMethod(obj,"privatefunc","afterHookedMethod privatefunc is called XposedHelpers.callMethod",111);
    
            XposedBridge.log("getNickname is called afterHookedMethod->"+param.thisObject);
        }
    });
    

    加壳APP处理

    /*
    1、对于有壳的apk,Xposed首先拿到的是壳的classloader
    2、壳一般在,壳代码的OnCreate修成classloader
    */
    public class HookShellApk implements IXposedHookLoadPackage {
    
        public static Field getClassField(ClassLoader classloader, String class_name,
                                          String filedName) {
    
            try {
                Class obj_class = classloader.loadClass(class_name);//Class.forName(class_name);
                Field field = obj_class.getDeclaredField(filedName);
                field.setAccessible(true);
                return field;
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            return null;
    
        }
    
        public static Object getClassFieldObject(ClassLoader classloader, String class_name, Object obj,
                                                 String filedName) {
    
            try {
                Class obj_class = classloader.loadClass(class_name);//Class.forName(class_name);
                Field field = obj_class.getDeclaredField(filedName);
                field.setAccessible(true);
                Object result = null;
                result = field.get(obj);
                return result;
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            }
            return null;
    
        }
    
        public static Object invokeStaticMethod(String class_name,
                                                String method_name, Class[] pareTyple, Object[] pareVaules) {
    
            try {
                Class obj_class = Class.forName(class_name);
                Method method = obj_class.getMethod(method_name, pareTyple);
                return method.invoke(null, pareVaules);
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (NoSuchMethodException e) {
                e.printStackTrace();
            } catch (InvocationTargetException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            }
            return null;
    
        }
    
        public static Object getFieldOjbect(String class_name, Object obj,
                                            String filedName) {
            try {
                Class obj_class = Class.forName(class_name);
                Field field = obj_class.getDeclaredField(filedName);
                field.setAccessible(true);
                return field.get(obj);
            } catch (SecurityException e) {
                e.printStackTrace();
            } catch (NoSuchFieldException e) {
                e.printStackTrace();
            } catch (IllegalArgumentException e) {
                e.printStackTrace();
            } catch (IllegalAccessException e) {
                e.printStackTrace();
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
            } catch (NullPointerException e) {
                e.printStackTrace();
            }
            return null;
    
        }
    
        public static ClassLoader getClassloader() {
            ClassLoader resultClassloader = null;
            Object currentActivityThread = invokeStaticMethod(
                    "android.app.ActivityThread", "currentActivityThread",
                    new Class[]{}, new Object[]{});
            Object mBoundApplication = getFieldOjbect(
                    "android.app.ActivityThread", currentActivityThread,
                    "mBoundApplication");
            Application mInitialApplication = (Application) getFieldOjbect("android.app.ActivityThread",
                    currentActivityThread, "mInitialApplication");
            Object loadedApkInfo = getFieldOjbect(
                    "android.app.ActivityThread$AppBindData",
                    mBoundApplication, "info");
            Application mApplication = (Application) getFieldOjbect("android.app.LoadedApk", loadedApkInfo, "mApplication");
            resultClassloader = mApplication.getClassLoader();
            return resultClassloader;
        }
    
        public void GetClassLoaderClasslist(ClassLoader classLoader) {
            //private final DexPathList pathList;
            //public static java.lang.Object getObjectField(java.lang.Object obj, java.lang.String fieldName)
            XposedBridge.log("start dealwith classloader:" + classLoader);
            Object pathListObj = XposedHelpers.getObjectField(classLoader, "pathList");
            //private final Element[] dexElements;
            Object[] dexElementsObj = (Object[]) XposedHelpers.getObjectField(pathListObj, "dexElements");
            for (Object i : dexElementsObj) {
                //private final DexFile dexFile;
                Object dexFileObj = XposedHelpers.getObjectField(i, "dexFile");
                //private Object mCookie;
                Object mCookieObj = XposedHelpers.getObjectField(dexFileObj, "mCookie");
                //private static native String[] getClassNameList(Object cookie);
                //    public static java.lang.Object callStaticMethod(java.lang.Class<?> clazz, java.lang.String methodName, java.lang.Object... args) { /* compiled code */ }
                Class DexFileClass = XposedHelpers.findClass("dalvik.system.DexFile", classLoader);
    
                String[] classlist = (String[]) XposedHelpers.callStaticMethod(DexFileClass, "getClassNameList", mCookieObj);
                for (String classname : classlist) {
                    XposedBridge.log(dexFileObj + "---" + classname);
                }
            }
            XposedBridge.log("end dealwith classloader:" + classLoader);
    
        }
    
        @Override
        public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
            Log.i("Xposed01", loadPackageParam.packageName);
            XposedBridge.log("HookLebo->app packagename" + loadPackageParam.packageName);
            if (loadPackageParam.packageName.equals("com.test.abc")) {
                XposedBridge.log("showme " + loadPackageParam.packageName);
                Class StubAppClass=XposedHelpers.findClass("com.test.abc.MyWrapperProxyApplication",loadPackageParam.classLoader);
                Method[] methods=StubAppClass.getDeclaredMethods();
                for(Method i:methods){
                    XposedBridge.log("com.test.abc.MyWrapperProxyApplication->"+i);
                }
                XposedHelpers.findAndHookMethod("com.test.abc.MyWrapperProxyApplication", loadPackageParam.classLoader, "onCreate", new XC_MethodHook() {
                    @Override
                    protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                        super.beforeHookedMethod(param);
                        XposedBridge.log("com.test.abc.MyWrapperProxyApplication->onCreate beforeHookedMethod");
                    }
    
                    @Override
                    protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                        super.afterHookedMethod(param);
                        XposedBridge.log("com.test.abc.MyWrapperProxyApplication->onCreate afterHookedMethod");
    
                        ClassLoader finalClassLoader=getClassloader();
                        XposedBridge.log("finalClassLoader->" + finalClassLoader);
                        XposedHelpers.findAndHookMethod("com.orginal.apk.MainActivity", finalClassLoader, "onCreate", Bundle.class, new XC_MethodHook() {
                            @Override
                            protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
                                super.beforeHookedMethod(param);
                                XposedBridge.log("beforeHookedMethod com.orginal.apk.MainActivity.onCreate");
    
                            }
    
                            @Override
                            protected void afterHookedMethod(MethodHookParam param) throws Throwable {
                                super.afterHookedMethod(param);
                                XposedBridge.log("afterHookedMethod com.orginal.apk.MainActivity.onCreate");
    
                            }
                        });
                    }
                });
            }
        }
    }
    
    

    so中函数处理

    1、创建android studio native项目,使用inhook框架,编写hook的内容
    2、通过Xposed,在java.lang.Runtime.loadLibrary的时机加载so

    // java.lang.System.loadLibrary,的下一级,会使用当前调用者的ClassLoader,所以会被使用成Xposed的ClassLoader
    // 可以用java.lang.Runtimem,但是在不同版本的源码中,loadLibrary的名字不一样,需要适配
    XposedHelpers.findAndHookMethod("java.lang.Runtime", loadPackageParam.classLoader, "loadLibrary", String.class,ClassLoader.class, new XC_MethodHook() {
        @Override
        protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
            super.beforeHookedMethod(param);
            String soname= (String) param.args[0];
            XposedBridge.log("beforeHookedMethod Runtime.load("+soname+","+param.args[1]+")");
        }
    
        @Override
        protected void afterHookedMethod(MethodHookParam param) throws Throwable {
            super.afterHookedMethod(param);
            String soname= (String) param.args[0];
            XposedBridge.log("afterHookedMethod Runtime.load("+soname+")");
            if(soname.contains("native-lib")){
                System.load("/data/data/com.showme.xposedhookso/files/hookso.so");
            }
        }
    });
    
    对于armv8,可以使用sandHook框架
    

    指纹检测与简单定制

    
    
    展开全文
  • Xposed所需要使用的lib库,解压后,复制到Android Studio的module的libs目录下
  • Xposed使用

    2019-05-13 16:30:28
    下载Xposed apk https://repo.xposed.info/module/de.robv.android.xposed.installer安装写hoo框架(就是普通apk项目)的时候先导入 jar包这个包要和下载Xposed版本...compileOnly 'de.robv.android.xposed:api:82'...

    下载Xposed apk https://repo.xposed.info/module/de.robv.android.xposed.installer
    安装
    写hoo框架(就是普通apk项目)的时候
    先导入 jar包这个包要和下载Xposed版本一样,可以自己编译也可以网上找别人的。
    Xposed使用
    然后修改配置 网上一般是这种

    Xposed使用

    compileOnly 'de.robv.android.xposed:api:82'
        compileOnly 'de.robv.android.xposed:api:82:sources'

    我这里是直接导入路径
    Xposed使用

    compileOnly files('lib/XposedBridgeAPI-89.jar')
    然后在main下创建一个目录assets(名称必须)
    然后在assets创建一个xposed_init文件(名称必须)
    在assets同目录下新创建一个java文件Main(名称随便)
    然后在java实现协议同时在xposed_init写你的包含函数路径
    Xposed使用
    Xposed使用

     package com.example.a22073.myhook;
    
    import de.robv.android.xposed.IXposedHookLoadPackage;
    import de.robv.android.xposed.XC_MethodHook;
    import de.robv.android.xposed.XposedBridge;
    import de.robv.android.xposed.XposedHelpers;
    import de.robv.android.xposed.callbacks.XC_LoadPackage;
    
    public class Main implements IXposedHookLoadPackage {
        @Override
        public void handleLoadPackage(XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable {
            if (loadPackageParam.packageName.equals("com.example.a22073.myapplication")) {
                XposedBridge.log("handleLoadPackage!!!!!!!!!");
            }
        }
    }
    

    最后在配置文件中加上三名话

      <meta-data
                android:name="xposedmodule"
                android:value="true" />
            <meta-data
                android:name="xposeddescription"
                android:value="Xposed Test" />
            <meta-data
                android:name="xposedminversion"
                android:value="89" />

    Xposed使用

    安装到手机同时Xposed会提示有新模块,如果没有说明项目创建错误。
    同时Xposed的日志在这里
    Xposed使用

    Xposed使用

    https://www.colabug.com/5324975.html

    转载于:https://blog.51cto.com/haidragon/2393810

    展开全文
  • 今天学习android hook,需要使用到api-82.jar,然而论坛上大部分资源都要积分 程序员何必为难程序员 0积分资源奉上 欢迎下载!
  • Xposed 模块编写

    2020-02-18 17:15:52
    compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82:sources' 2.在AndroidManifest.xml的application内添加 <!-- 是否是xposed模块,xposed根据这...

    1.在appbuild.gradledependencies内添加

    compileOnly 'de.robv.android.xposed:api:82'
    compileOnly 'de.robv.android.xposed:api:82:sources'
    

    2.在AndroidManifest.xmlapplication内添加

    <!-- 是否是xposed模块,xposed根据这个来判断是否是模块 -->
    <meta-data
        android:name="xposedmodule"
        android:value="true" />
    
    <!-- 模块描述,显示在xposed模块列表那里第二行 -->
    <meta-data
        android:name="xposeddescription"
        android:value="This is a Xposed module" />
    
    <!-- 最低xposed版本号(lib文件名可知) -->
    <meta-data
        android:name="xposedminversion"
        android:value="54" />
    

    3.编写Hook类 HookClass 继承 IXposedHookLoadPackage

    4.在app\src\main目录下新建assets目录,并新建xposed_init文件添加HookClass的全类名(即包名.类名)

    xxx.xxx.HookClass
    
    展开全文
  • Xposed源码编译

    2019-06-10 23:18:36
    参考博文 参考掘金系列博文 参考博文 源码编译和镜像编译 参考博文 编译Xposed 参 考博文 https://www.jianshu.com/p/c731cd44e82b 参考博文 ...Xposed简介 ...Xposed是...

    参考博文

    编译Xposed

    • 参 考博文 https://www.jianshu.com/p/c731cd44e82b
    • 参考博文 https://www.cnblogs.com/luoyesiqiu/p/9524651.html

    Xposed简介

    • Xposed是Android平台上的有名的Hook工具,用它可以修改函数参数,函数返回值和类字段值等等,也可以用它来进行调试。Xposed有几个部分组成:修改过的android_art,这个项目修改部分art代码,使Hook成为可能
    • Xposed native部分,该部分主要提供给XposedBridge可调用api和调用修改过的android_art的api,还有生成可替换的app_process程序
    • XposedBridge,该项目是主要功能是提供给Xposed的模块开发者api,它将编译成XposedBridge.jar
    • XposedInstaller,该项目是Xposed安装器,使得普通用户在使用Xposed更方便,同时,它还可以管理手机上已经安装的Xposed模块,它编译完成后将生成apk文件,本文不讨论如何编译它。

    编译准备

    • Ubuntu系统,推荐16.04及以上,本文用的18.04
    • Android Studio
    • Android源码(下载链接,请百度)
    • 修改过的android_art:https://github.com/rovo89/android_art
    • Xposed native部分:https://github.com/rovo89/Xposed
    • XposedBridge:https://github.com/rovo89/XposedBridge
    • Xposed构建工具,XposedTools:https://github.com/rovo89/XposedTools

    配置

    • Android-ART
      • 将Android源码下的art目录移动到其他路径备份,比如Android源码的上层路径
      • 在Android源码路径执行git clone https://github.com/rovo89/android_art -b xposed-nougat-mr2 art,注意根据Android源码版本选择分支或者对应的标签
    • Xposed Native

      • 转到frameworks/base/cmds目录,执行git clone https://github.com/rovo89/Xposed xposed,将Xposed Native部分的源码下载
    • XposedBridge
      • 在任意目录执行git clone https://github.com/rovo89/XposedBridge -b art,然后导入Android Studio中,点Build->Rebuild Project,会在app/build/intermediates/transform/preDex/release目录下生成.jar文件,将生成的jar文件重命名为XposedBridge.jar,放入Android源码目录下的out/java/下。也可以直接生成apk,然后将生成的apk后缀改为jar
      • 将生成的jar导入aosp/out/target/product/hammerhead/system/framework/

    这里jar文件存放的目录不同的博文是不一致的,但是觉得framework里面靠谱一点

    注:如果想生成供Xposed模块调用的XposedBridge.jar,则在Android Studio的右侧打开Gradle Project,双击jarStubs就会在app/build/api生成api.jar

    • XposedTools
      • 在任意目录执行git clone https://github.com/rovo89/XposedTools,将XposedTools目录下的build.conf.sample复制一份,并将它重命名为build.conf,build.conf文件用于配置构建环境,我们来看他的内容:
    [General]
    outdir = /home/misty/bin/WORKING_DIRECTORY/out
    #javadir = /android/XposedBridge
    
    [Build]
    # Please keep the base version number and add your custom suffix
    version = 86 (custom build by xyz / %s)
    # makeflags = -j4
    
    [GPG]
    sign = release
    user = 852109AA!
    
    # Root directories of the AOSP source tree per SDK version
    [AospDir]
    #19 = /android/aosp/440
    #21 = /android/aosp/500
    23 = /home/misty/bin/WORKING_DIRECTORY
    
    # SDKs to be used for compiling BusyBox
    # Needs https://github.com/rovo89/android_external_busybox
    
    #[BusyBox]
    #arm = 23
    #x86 = 23
    #armv5 = 23
    
    
    
    * outdir:指定Android源码中的out目录
    * javadir:指定XposedBridge目录,如果你不需要编译XposedBridge.jar可以不指定
    * version:Xposed版本,这个版本号将显示在XposedInstaller上
    * ApospDir下的数字:设置sdk版本对应的Android源码
    * [BusyBox]标签:busybox,可以不指定
    
    • 配置完成后,就可以执行build.pl编译了,以下有几个例子:

    ./build.pl -a java

    • 编译XposedBridge.jar,需要在build.conf里指定javadir

    ./build.pl -t arm64:23

    • 编译生成供cpu架构为arm64,sdk为23平台使用的Xposed
    • 编译完成后,将在Android源码目录/out/sdk23/arm生成可刷入手机的zip文件

    配置 perl 环境

    • XposedTools 依赖于 perl,所以我们要跑起来就要有一个 perl 环境。首次运行 perl 需要安装依赖 Config::IniFiles
      perl -MCPAN -e 'install Config::IniFiles'

    • 大概需要在安装下面的两个依赖(不同系统可能不同)
      perl -MCPAN -e 'install File::Tail'
      perl -MCPAN -e 'install File::ReadBackwards'

    • 如果还不成功,按照下面的方法安装所需的模块即可
      perl -MCPAN -e 'install [ModuleName]'

    解决模块安装失败的问题

    • 执行build.pl的时候提示找不到函数,比如提示找不到Config::IniFiles. 可以通过下面的方式来寻找并安装依赖:
      • 执行apt-cache search Config::IniFiles寻找Config::IniFiles所依赖的库文件
      • 执行sudo apt install libconfig-inifiles-perl安装所依赖的库
        libconfig-inifiles-perl - Read .ini-style configuration files
    
    • 使用aptitude工具下载依赖
      • sudo aptitude install Config::IniFiles
      • sudo aptitude install File::Tail
      • sudo aptitude install File::ReadBackwards
        >虽然可能会出现安装失败,但是会出现依赖提醒,按照提示安装依赖即可

    常见问题

    • art更名替换导致如下错误,不可以在源码根目录下,需要移动到其他目录,本例移动到上级目录
        build/core/base_rules.mk:157: *** art_bak: MODULE.TARGET.FAKE.cpplint-art-phony already defined by art。 停止。
    
           #### make failed to build some targets (6 seconds) ####
    

    编译XposedBridge问题

    编译android6.0源码需要java1.7,而编译xposedbridge需要java1.8,所以这里为了切换方便临时指定Java环境变量

    misty@ubuntu:~/bin/xposed/XposedTools$ ./build.pl -a java 
    Loading config file /home/misty/bin/xposed/XposedTools/build.conf...
    Checking requirements...
    Building the Java part...
    Compiling...
    
    FAILURE: Build failed with an exception.
    
    * Where:
    Build file '/home/misty/bin/xposed/XposedBridge/app/build.gradle' line: 3
    
    * What went wrong:
    A problem occurred evaluating project ':app'.
    > java.lang.UnsupportedClassVersionError: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
    
    * Try:
    Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.
    
    BUILD FAILED
    
    Total time: 0.682 secs
    misty@ubuntu:~/bin/xposed/XposedTools$ vim /etc/profile
    misty@ubuntu:~/bin/xposed/XposedTools$ export JAVA_HOME=/home/misty/MyFile/jdk1.8.0_211
    misty@ubuntu:~/bin/xposed/XposedTools$ export PATH=$PATH:$JAVA_HOME/bin
    misty@ubuntu:~/bin/xposed/XposedTools$ java -version
    

    相关命令

    • getprop|grep arm 查看CPU相关的信息
    展开全文
  • 项目导入在app/build.gradle中配置repositories {jcenter()}dependencies {compileOnly 'de.robv.android.xposed:api:82'}2.在AndroidManifest.xml配置android:name="xposedmodule"android:value="true" /&g...
  • 关于xposed

    2019-03-06 14:08:17
    1.Android4.4.4 ,使用xposedbriggeapi-54.jar,试了很久都不行 ,后来改用api-82,成功hook2.findAndHookMethod(),需要传要hook方法的参数类型,如果参数类型为类或者接口,需要用Class clazz=loadPackageParam....
  • xposed初探1

    2018-06-20 16:11:52
    1 将xposed的jar api包放进来 api-82.jar api-82-source.jar   2  在两个jar包上右键Add as library 点击OK确认 配置这两个jar包为provided.因为安装xposed框架的时候框架里面会自动带。所以要把compile...
  • Xposed的使用

    2018-09-03 10:04:36
    compileOnly 'de.robv.android.xposed:api:82' 然后在androidManifest.xml中添加&lt;meta-data&gt;说明Xposed的版本号以及相关信息,注意要放在application之中 &lt;meta-d...
  • 安卓xposed环境搭建

    2020-11-19 17:26:22
    导入xposed环境 app目录下新建 lib 目录,导入xposedbrige82api.jar build.gralde 修改依赖。dependencies 注意!...compileOnly 'de.robv.android.xposed:api:82:sources' compileOnly files(lib/
  • Lower Xposed Min Version

    2020-12-26 07:30:36
    <div><p>Devices (pre Lollipop) can have only Xposed framework 2.6/2.7 with Xposed Bridge cca 54, so 82 as min version makes them unsupported. Fix this.</p><p>该提问来源于开源项目:devadvance/...
  • Xposed 免重启调试

    千次阅读 2019-01-23 22:48:42
    如何配置 Android Studio 项目为 Xposed ... compileOnly 'de.robv.android.xposed:api:82'  compileOnly 'de.robv.android.xposed:api:82:sources' 注:需要 compileOnly 来依赖,如果不想通过 Gradle 配置,也...
  • xposed编写hook模块

    千次阅读 2019-06-20 10:52:52
    首先按照网上教程,编写最简单的load包名模块。...compileOnly 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82:sources' 然后同步一下,没有报错就可以了,之前一直下载jar包然后添...
  • 1. Xposed插件Hello World ... provided 'de.robv.android.xposed:api:82' provided 'de.robv.android.xposed:api:82:sources' 官方链接 修改AndroidManifest 在AndroidManifest中修改如下: <applic...
  • 微信Xposed案例实战

    2020-04-06 22:51:35
    一、Xposed环境配置和简单的demo 一、新建项目 二、配置相关文件 a.配置activity_main.xml,这个只需要添加一个测试用的按钮即可 b.配置MainActivity.java,同样只需要实现一个按钮事件即可 重点来了: c.添加api-82...
  • xposed初级流程

    2019-05-22 18:29:12
    api-82-sources.jar: 包含源码的 api-82.jar: 不包含源码 拷贝两个文件到 ..\HookDemo\app\libs目录下, 修改 ..\HookDemo\app\build.gradle 中的 dependencies 选项,用compileOnly添加上面的api-82.jar依赖,因为...
  • Xposed模块开发不起作用

    千次阅读 2019-03-04 17:24:33
    // implementation 'de.robv.android.xposed:api:82' compileOnly 'de.robv.android.xposed:api:82' implementation 'de.robv.android.xposed:api:82':这个是不行的,要使用: compileOnly 'de.rob...
  • 0x01 xposed hook原理 ...在Android项目中新建一个lib文件夹,将api-82-sources.jar、api-82.jar放入该文件夹中;右键api-xx.jar文件 api-XX.jar 选择Build Path -> Add to Build Path API下...
  • xposed第一个demo

    千次阅读 2018-09-12 17:04:46
    xposed出来已经很久了,一直也没去了解,今天抽时间...provided 'de.robv.android.xposed:api:82' 很多博客里说要把 改成 provided,其实不用,另外现在的xposed已经不用root和机器重启了,软件内部启动就好 ma...
  • Android 4.0.3 up to Android 4.4: 框架:de.robv.android.xposed.installer_v33_36570c.apk API:XposedBridgeApi-54.jar Android 5.0 or higher: 框架:XposedInstaller_3.0_alpha4....API:XposedBridgeApi-82.jar
  • My device is currently running AOKP KitKat 4.4.4 and Kernel Linux version 3.4.82-g47fef4f. <p>Upon installing any new or updating any App, my Launcher as well as the Xposed Installer crashes and I ...
  • Xposed Xposed的使用有2点限制条件 1 需要Root 2 适用于Android4-Android9, 在...compileOnly 'de.robv.android.xposed:api:82' 新建一个Java类,实现IXposedHookLoadPackage接口,用来Hook方法 package com.ex
  • Xposed 包名修改(防检测)

    千次阅读 2018-12-11 10:39:31
    Xposed源码编译 该实现需要基于Xposed源码编译, 不会源码编译的建议先研究下如何编译, 推荐下面的文章 https://www.jianshu.com/p/73e01e7b1bd8 https://www.jianshu.com/p/c14eafe5e1d7 ...XposedBridge包名修改 ...
  • xposed框架集成跟遇到的几个坑

    千次阅读 2019-02-14 10:17:05
    1 引入 jar 包 XposedBridgeApi-82.jar 引入 jar 包有个巨坑 :  我们新建项目的时候是自动生成下面的代码 compile fileTree(include: ['*.jar'], dir: 'libs') 该代码作用是自动引用 libs 文件夹下的...
  • de.robv.android.xposed:api:82'. There was no issue with this in some previous Ed Xposed version, at least on 4.1.2. <p>You can see source code of this class here - ...

空空如也

空空如也

1 2 3
收藏数 52
精华内容 20
关键字:

82xposed