Hook Android interface with Xposed framework

Recently, I was researching and grasping the data returned by the interface in Android, and I saw this knowledge. In fact, there are quite a lot of posts on the Internet using the Xposed framework to hook the Android interface.

Reference sticker:

http://blog.csdn.net/zhangmiaoping23/article/details/52315745

 

Step a: Install the XposedInstall tool

Install XposedInstaller on Android devices above Android 4.0 (root permissions are required, it is recommended to use the emulator directly) 

After installing XposedInstaller, click the framework, click Install/Update, and then restart, after installation is as follows:


 

Step b: Write the plugin

XposedTest: Plug-in project, see the attachment for details. There are a few places to write:

1. The xposed_init file in the assets directory

com.example.xposedtest.HookUtil

2. Configuration in Manifest

<meta-data android:name="xposedmodule" android:value="true" />

<meta-data android:name="xposeddescription" android:value="登录hook例子!" />

<meta-data android:name="xposedminversion" android:value="54" />

3. Code in the HookUtil class

 

Step c: Select the plugin

Remember, after selecting the model, be sure to restart! Otherwise, it will not take effect and there will be no error message.

 

Step d: show the effect

I directly grabbed the onClick interface of Activity


onClick function

effect

 
 

Precautions:

1. It is recommended to use the simulator to test. The real machine on my side, XposedInstall does not support it, and I did not try it.

2. The object reflected in the hook plug-in is not the id in the xml, but the object in the Activity

The object to be controlled by reflection in the plugin:


 The object you want to control:


3. If the plug-in wants to control the space of LoginTest, such as EditText, then the space must be public but not private. I don’t know why (I didn’t report an error when I used private later. It is said on the Internet that getDeclaredField can reflect private objects, but I don’t know why before. will fail)

4. The hook code can be directly put into the apk of LoginTest, and the pro test is effective.

 

 But to be honest, there is no way to simply grab the package on the user's mobile phone through the code, and you have to think about it.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326137716&siteId=291194637