├── .classpath
├── .gitignore
├── .project
├── .settings
├── org.eclipse.core.resources.prefs
└── org.eclipse.jdt.core.prefs
├── AndroidManifest.xml
├── README.md
├── assets
├── message.xml
└── xposed_init
├── bin
├── AndroidManifest.xml
├── XposedHookDemo.apk
├── classes.dex
├── res
│ └── crunch
│ │ ├── drawable-hdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-mdpi
│ │ └── ic_launcher.png
│ │ ├── drawable-xhdpi
│ │ └── ic_launcher.png
│ │ └── drawable-xxhdpi
│ │ └── ic_launcher.png
└── resources.ap_
├── gen
└── cn
│ └── wjdiankong
│ └── xposedhook
│ ├── BuildConfig.java
│ └── R.java
├── ic_launcher-web.png
├── proguard-project.txt
├── project.properties
├── res
├── drawable-hdpi
│ └── ic_launcher.png
├── drawable-mdpi
│ └── ic_launcher.png
├── drawable-xhdpi
│ └── ic_launcher.png
├── drawable-xxhdpi
│ └── ic_launcher.png
├── layout
│ └── activity_demo.xml
└── values
│ ├── dimens.xml
│ ├── strings.xml
│ └── styles.xml
└── src
└── cn
└── wjdiankong
└── xposedhook
├── HookAppAllMethod.java
├── MainActivity.java
└── XposedInit.java
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | *.class
2 |
3 | # Mobile Tools for Java (J2ME)
4 | .mtj.tmp/
5 |
6 | # Package Files #
7 | *.jar
8 | *.war
9 | *.ear
10 |
11 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
12 | hs_err_pid*
13 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | XposedHookDemo
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.andmore.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.andmore.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | org.eclipse.andmore.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | org.eclipse.andmore.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.core.resources.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | encoding/=UTF-8
3 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate
4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.compliance=1.7
7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
11 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
12 | org.eclipse.jdt.core.compiler.source=1.7
13 |
--------------------------------------------------------------------------------
/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
40 |
43 |
46 |
47 |
50 |
51 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # XposedHookAllMethod
2 | Xposed框架Hook加固应用的所有方法信息
3 |
4 | 详情请移步博客:[http://www.wjdiankong.cn](http://www.wjdiankong.cn)
5 |
--------------------------------------------------------------------------------
/assets/message.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 猩球崛起之---请善待互联网界珍稀物种(程序猿)!
5 | 生死看淡,不服就干!这是作为程序猿最基本的素质,切勿为了一行代码丢失了我们作为程序猿的尊严!当尊严和需求并存的时候,我们应该毫不犹豫的选择需求,因为多一事不如少一事!先忍着以后再说!
6 |
7 | 5
8 | 0
9 |
10 |
11 |
12 |
13 | 0
14 | http://mp.weixin.qq.com/s?__biz=MzIzNDA3MDgwNA==&mid=2649230231&idx=1&sn=6fe6cfe54ec3fe498abad855e7ed8365&chksm=f0e75decc790d4fa2241ff2164d2a3d06f4f6a6f1d5918aadb2ba20585107e7c03800d86f061&mpshare=1&scene=1&srcid=0117EvOrmxjoCd7N8HwBWKzk#rd
15 |
16 |
17 |
18 |
19 | 0
20 |
21 |
22 |
23 | 3044020100043d303b020100020410cf7e0e02033d0af502046f4c977b0204587dd2ba04196a773130393536333930303432315f313438343634303935340201000201000400
24 |
25 | 6853
26 | 160
27 | 160
28 | 061f6908494f43cd879b394724f89a32
29 | 061f6908494f43cd879b394724f89a32
30 | 0
31 |
32 |
33 | gh_1322d5f620b9
34 | 编码美丽
35 |
36 | http://mmbiz.qpic.cn/mmbiz_jpg/YaEr5ib6GPqWYgAP5pmluXaBsIFm6ju53xzrxO9sJDqr7mC22JlTRTH9CM1J1SR9CW0YQ2u7ibU1TkdiaUREEfDQw/300?wx_fmt=jpeg&wxfrom=1
37 |
38 |
39 |
40 | wxid_t7vbsdxkj2th22
41 | 0
42 |
43 | 1
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/assets/xposed_init:
--------------------------------------------------------------------------------
1 | cn.wjdiankong.xposedhook.XposedInit
2 |
--------------------------------------------------------------------------------
/bin/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
36 |
37 |
40 |
43 |
46 |
47 |
50 |
51 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
--------------------------------------------------------------------------------
/bin/XposedHookDemo.apk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/XposedHookDemo.apk
--------------------------------------------------------------------------------
/bin/classes.dex:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/classes.dex
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/res/crunch/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/res/crunch/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/res/crunch/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/res/crunch/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/res/crunch/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/bin/resources.ap_:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/bin/resources.ap_
--------------------------------------------------------------------------------
/gen/cn/wjdiankong/xposedhook/BuildConfig.java:
--------------------------------------------------------------------------------
1 | /** Automatically generated file. DO NOT MODIFY */
2 | package cn.wjdiankong.xposedhook;
3 |
4 | public final class BuildConfig {
5 | public final static boolean DEBUG = true;
6 | }
--------------------------------------------------------------------------------
/gen/cn/wjdiankong/xposedhook/R.java:
--------------------------------------------------------------------------------
1 | /* AUTO-GENERATED FILE. DO NOT MODIFY.
2 | *
3 | * This class was automatically generated by the
4 | * aapt tool from the resource data it found. It
5 | * should not be modified by hand.
6 | */
7 |
8 | package cn.wjdiankong.xposedhook;
9 |
10 | public final class R {
11 | public static final class attr {
12 | }
13 | public static final class dimen {
14 | /** Default screen margins, per the Android Design guidelines.
15 | */
16 | public static final int activity_horizontal_margin=0x7f040000;
17 | public static final int activity_vertical_margin=0x7f040001;
18 | }
19 | public static final class drawable {
20 | public static final int ic_launcher=0x7f020000;
21 | }
22 | public static final class id {
23 | public static final int hinttxt=0x7f070001;
24 | public static final int savemethod=0x7f070000;
25 | }
26 | public static final class layout {
27 | public static final int activity_demo=0x7f030000;
28 | }
29 | public static final class string {
30 | public static final int action_settings=0x7f050002;
31 | public static final int app_name=0x7f050000;
32 | public static final int current_location=0x7f050005;
33 | public static final int hello_world=0x7f050001;
34 | public static final int save_location=0x7f050003;
35 | public static final int tip=0x7f050004;
36 | }
37 | public static final class style {
38 | /** Base application theme.
39 | Customize your theme here.
40 | */
41 | public static final int AppTheme=0x7f060000;
42 | }
43 | }
44 |
--------------------------------------------------------------------------------
/ic_launcher-web.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/ic_launcher-web.png
--------------------------------------------------------------------------------
/proguard-project.txt:
--------------------------------------------------------------------------------
1 | # To enable ProGuard in your project, edit project.properties
2 | # to define the proguard.config property as described in that file.
3 | #
4 | # Add project specific ProGuard rules here.
5 | # By default, the flags in this file are appended to flags specified
6 | # in ${sdk.dir}/tools/proguard/proguard-android.txt
7 | # You can edit the include path and order by changing the ProGuard
8 | # include property in project.properties.
9 | #
10 | # For more details, see
11 | # http://developer.android.com/guide/developing/tools/proguard.html
12 |
13 | # Add any project specific keep options here:
14 |
15 | # If your project uses WebView with JS, uncomment the following
16 | # and specify the fully qualified class name to the JavaScript interface
17 | # class:
18 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview {
19 | # public *;
20 | #}
21 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system edit
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 | #
10 | # To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home):
11 | #proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
12 |
13 | # Project target.
14 | target=android-23
15 |
--------------------------------------------------------------------------------
/res/drawable-hdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/res/drawable-hdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/res/drawable-mdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/res/drawable-xhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/drawable-xxhdpi/ic_launcher.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/fourbrother/XposedHookAllMethod/20894374a28da5fc4d3a926640bc0a5cd72c8374/res/drawable-xxhdpi/ic_launcher.png
--------------------------------------------------------------------------------
/res/layout/activity_demo.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
15 |
16 |
23 |
24 |
--------------------------------------------------------------------------------
/res/values/dimens.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | 16dp
4 | 16dp
5 |
6 |
--------------------------------------------------------------------------------
/res/values/strings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | XposedHookDemo
5 | Hello world!
6 | Settings
7 | Save location
8 | Select longtitue and latitude by click, long press, double click the map
9 | Current location:
10 |
11 |
12 |
--------------------------------------------------------------------------------
/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/cn/wjdiankong/xposedhook/HookAppAllMethod.java:
--------------------------------------------------------------------------------
1 | package cn.wjdiankong.xposedhook;
2 |
3 | import java.io.BufferedWriter;
4 | import java.io.File;
5 | import java.io.FileWriter;
6 | import java.lang.reflect.Field;
7 | import java.lang.reflect.Method;
8 | import java.lang.reflect.Modifier;
9 | import java.util.Collections;
10 | import java.util.HashSet;
11 | import java.util.List;
12 | import java.util.Set;
13 |
14 | import android.annotation.SuppressLint;
15 | import android.app.Application;
16 | import android.content.Context;
17 | import android.text.TextUtils;
18 | import android.util.Log;
19 | import de.robv.android.xposed.XC_MethodHook;
20 | import de.robv.android.xposed.XC_MethodHook.MethodHookParam;
21 | import de.robv.android.xposed.XposedHelpers;
22 | import de.robv.android.xposed.callbacks.XC_LoadPackage.LoadPackageParam;
23 |
24 | public class HookAppAllMethod {
25 |
26 | public static Set methodSignSet = Collections.synchronizedSet(new HashSet());
27 | public static Set callMethodSignSet = Collections.synchronizedSet(new HashSet()) ;
28 |
29 | private static final String FILTER_PKGNAME = "cn.wjdiankong.toutiaovideo";
30 |
31 | public static void hookMethod(LoadPackageParam loadPackageParam){
32 | String pkgname = loadPackageParam.packageName;
33 | if(FILTER_PKGNAME.equals(pkgname)){
34 | //这里是为了解决app多dex进行hook的问题,Xposed默认是hook主dex
35 | XposedHelpers.findAndHookMethod(Application.class, "attach", Context.class, new XC_MethodHook() {
36 | @Override
37 | protected void afterHookedMethod(MethodHookParam param) throws Throwable {
38 | ClassLoader cl = ((Context)param.args[0]).getClassLoader();
39 | Class> hookclass = null;
40 | try {
41 | hookclass = cl.loadClass("dalvik.system.DexFile");
42 | } catch (Exception e) {
43 | return;
44 | }
45 |
46 | XposedHelpers.findAndHookMethod(hookclass, "loadClass", String.class, ClassLoader.class, new XC_MethodHook(){
47 | @Override
48 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
49 | hookClassInfo((String)param.args[0], (ClassLoader)param.args[1]);
50 | super.beforeHookedMethod(param);
51 | }
52 | });
53 |
54 | XposedHelpers.findAndHookMethod(hookclass, "loadClassBinaryName", String.class, ClassLoader.class, List.class,new XC_MethodHook(){
55 | @Override
56 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
57 | hookClassInfo((String)param.args[0], (ClassLoader)param.args[1]);
58 | super.beforeHookedMethod(param);
59 | }
60 | });
61 |
62 | XposedHelpers.findAndHookMethod(hookclass, "defineClass", String.class, ClassLoader.class, long.class, List.class,new XC_MethodHook(){
63 | @Override
64 | protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
65 | hookClassInfo((String)param.args[0], (ClassLoader)param.args[1]);
66 | super.beforeHookedMethod(param);
67 | }
68 | });
69 |
70 | }
71 | });
72 | }
73 | }
74 |
75 | /**
76 | * 获取dex路径
77 | * @param classLoader
78 | * @return
79 | */
80 | public static String getDexPath(ClassLoader classLoader){
81 | try{
82 | Field field = classLoader.getClass().getSuperclass().getDeclaredField("pathList");
83 | field.setAccessible(true);
84 | Object objPathList = field.get(classLoader);
85 | Field elementsField = objPathList.getClass().getDeclaredField("dexElements");
86 | elementsField.setAccessible(true);
87 | Object[] elements =(Object[])elementsField.get(objPathList);
88 | for(Object obj : elements){
89 | Field fileF = obj.getClass().getDeclaredField("file");
90 | fileF.setAccessible(true);
91 | File file = (File)fileF.get(obj);
92 | return file.getAbsolutePath();
93 | }
94 | }catch(Exception e){
95 | }
96 | return null;
97 | }
98 |
99 | private static void hookClassInfo(String className, ClassLoader classLoader){
100 | //过滤系统类名前缀
101 | if(TextUtils.isEmpty(className)){
102 | return;
103 | }
104 | if(className.startsWith("android.")){
105 | return;
106 | }
107 | if(className.startsWith("java.")){
108 | return;
109 | }
110 |
111 | //利用反射获取一个类的所有方法
112 | try{
113 | Class> clazz = classLoader.loadClass(className);
114 | //这里获取类的所有方法,但是无法获取父类的方法,不过这里没必要关系父类的方法
115 | //如果要关心,那么需要调用getMethods方法即可
116 | Method[] allMethods = clazz.getDeclaredMethods();
117 | for(Method method : allMethods){
118 | Class>[] paramTypes = method.getParameterTypes();
119 | String methodName = method.getName();
120 | Object[] param = new Object[paramTypes.length+1];
121 | for(int i=0;i"+methodSign);
137 | //这里还可以把方法的参数值打印出来,不过如果应用过大,这里会出现ANR
138 | for(int i=0;iarg"+i+":"+param.args[i]);
140 | }
141 | callMethodSignSet.add(methodSign);
142 | }
143 | super.afterHookedMethod(param);
144 | }
145 | };
146 |
147 | //开始进行Hook操作,注意这里有一个问题,如果一个Hook的方法数过多,会出现OOM的错误,这个是Xposed工具的问题
148 | if(!TextUtils.isEmpty(signStr) && !methodSignSet.contains(signStr)){
149 | //这里因为会打印日志,所以会出现app的ANR情况
150 | Log.i("jw", "all-->"+signStr);
151 | methodSignSet.add(signStr);
152 | XposedHelpers.findAndHookMethod(className, classLoader, methodName, param);
153 | }
154 | }
155 | }catch(Exception e){
156 | }
157 | }
158 |
159 | /**
160 | * 获取方法的签名信息
161 | * @param param
162 | * @return
163 | */
164 | private static String getMethodSign(MethodHookParam param){
165 | try{
166 | StringBuilder methodSign = new StringBuilder();
167 | methodSign.append(Modifier.toString(param.method.getModifiers())+" ");
168 | Object result = param.getResult();
169 | if(result == null){
170 | methodSign.append("void ");
171 | }else{
172 | methodSign.append(result.getClass().getCanonicalName() + " ");
173 | }
174 | methodSign.append(param.method.getDeclaringClass().getCanonicalName()+"."+param.method.getName()+"(");
175 | for(int i=0;i[] paramTypes = method.getParameterTypes();
208 | Class> returnTypes = method.getReturnType();
209 | methodSign.append(Modifier.toString(method.getModifiers()) + " ");
210 | methodSign.append(returnTypes.getCanonicalName() + " ");
211 | methodSign.append(methodClass+"."+method.getName()+"(");
212 | for(int i=0;i