How can I hook the xposed? I decided to hook de.robv.android.XposedBridge.handleHookedMethod
to hook all the methods in some apps.
package com.kyunggi.logcalls;
import android.util.*;
import de.robv.android.xposed.*;
import de.robv.android.xposed.callbacks.XC_LoadPackage.*;
import java.lang.reflect.*;
import static de.robv.android.xposed.XposedHelpers.findAndHookMethod;
public class Main implements IXposedHookLoadPackage
{
private String TAG = "LogCall";
public void handleLoadPackage(final LoadPackageParam lpparam)throwsThrowable {
if(!lpparam.packageName.equals("com.android.bluetooth"))
{
Log.i(TAG, "Not:" + lpparam.packageName);
return;
}
Log.i(TAG, "Yes" + lpparam.packageName);
findAndHookMethod("de.robv.android.xposed.XposedBridge", lpparam.classLoader, "handleHookedMethod", Member.class, int.class, Object.class, Object.class, Object[].class, newXC_MethodHook(){
@ Override
protected void beforeHookedMethod(MethodHookParamparam)throwsThrowable{
Method method=(Method)param.args[0];
Log.v(TAG, "className" + method.getClass().getName()+", methodName" + method.getName());
}
});
}
}
However, ClassNotFoundException
occurs.How can I solve this problem if I think it's a class loader problem?
de.robv.android.xposed.XposedHelpers$ClassNotFoundError:
java.lang.ClassNotFoundException: de.robv.android.xposed.XposedBridge
I got a system class loader using the following code and the hook itself succeeded.
ClassLoader rootcl=lpparam.classLoader.getSystemClassLoader();
findAndHookMethod("de.robv.android.xposed.XposedBridge", rootcl, "handleHookedMethod", Member.class, int.class, Object.class, Object.class, Object[].class, newXC_MethodHook(){
@ Override
protected void beforeHookedMethod(MethodHookParamparam)throwsThrowable{
Method method=(Method)param.args[0];
Log.v(TAG, "className" + method.getClass().getName()+", methodName" + method.getName());
}
});
By the way!
10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132]JNIERROR(app bug):
local reference table overflow (max=512) 10-18 18:27:22.198 F/art
(4490):art/runtime/indirect_reference_table.cc:132]local reference
table dump:10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] Last 10 entries (of
512): 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 511:0x12c58510
java.lang.reflect.Method 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132]510:0x12c8b860
java.lang.Object[] (5 elements) 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 509:0x12c8b840
java.lang.Object[] (5 elements) 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 508:0x12c45958
de.robv.android.xposed.XposedBridge$AdditionalHookInfo10-18
18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 507:0x12c58510
java.lang.reflect.Method 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 506:0x12c8b840
java.lang.Object[] (5 elements) 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 505:0x12c8b820
java.lang.Object[] (5 elements) 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 504:0x12c45958
de.robv.android.xposed.XposedBridge$AdditionalHookInfo10-18
18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 503:0x12c58510
java.lang.reflect.Method 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 502:0x12c8b820
java.lang.Object[] (5 elements) 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132]Summary: 10-18
18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 245 of
java.lang.Object[] (5 elements) (123 unique instances) 10-18
18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 124 of
java.lang.reflect.Method(2 unique instances) 10-18 18:27:22.198 F/art
(4490):art/runtime/indirect_reference_table.cc:132]123 of
de.robv.android.xposed.XposedBridge$AdditionalHookInfo(2unique
)
instances) 10-18 18:27:22.198 F/art (4490):
art/runtime/indirect_reference_table.cc:132] 5 of
java.lang.Class (4 unique instances) 10-18 18:27:22.198 F/art
(4490): art/runtime/indirect_reference_table.cc:132] 3 of
android.app.ResourcesManager(1 unique instances) 10-18 18:27:22.199
F/art (4490):art/runtime/indirect_reference_table.cc:132]
3 of java.lang.String (3 unique instances)
Therefore, I think XPOSED framework hook is not good.
© 2024 OneMinuteCode. All rights reserved.