Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

拦截系统函数出错 #8

Open
wyhuan opened this issue Oct 31, 2017 · 3 comments
Open

拦截系统函数出错 #8

wyhuan opened this issue Oct 31, 2017 · 3 comments

Comments

@wyhuan
Copy link

wyhuan commented Oct 31, 2017

android o上尝试拦截 android.webkit.WebView的loadUrl方法

代码如下:
Class<?> webViewClass = getClassLoader().loadClass("android.webkit.WebView");
HookManager.findAndHookMethod(webViewClass, "loadUrl", String.class, new MethodCallback() {
@OverRide
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
super.beforeHookedMethod(param);
Log.d("panda", "i'm in method " +param.method.getName()+" beforeHookedMethod");
}
@OverRide
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
super.afterHookedMethod(param);
Log.d("panda", "i'm in method " +param.method.getName()+" afterHookedMethod");
}
});
异常如下:
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.panda.hook.andhook, PID: 17591
java.lang.VerifyError: Verifier rejected class com.panda.hook.andhook.MainActivity: void com.panda.hook.andhook.MainActivity.onCreate(android.os.Bundle) failed to verify: void com.panda.hook.andhook.MainActivity.onCreate(android.os.Bundle): [0x4B] 'this' argument 'Reference: com.panda.hook.andhook.MyWebview' not instance of 'Reference: android_webkit_WebView' (declaration of 'com.panda.hook.andhook.MainActivity' appears in /data/app/com.panda.hook.andhook-jnxRzI9vY8XQW7tN8LeIQA==/split_lib_slice_0_apk.apk)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1174)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2669)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2856)
at android.app.ActivityThread.-wrap11(Unknown Source:0)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1589)
at android.os.Handler.dispatchMessage(Handler.java:106)
at android.os.Looper.loop(Looper.java:164)
at android.app.ActivityThread.main(ActivityThread.java:6494)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:438)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:807)

@panhongwei
Copy link
Owner

反射出现的问题,我正在修复这个问题

@wyhuan
Copy link
Author

wyhuan commented Oct 31, 2017

是8.0在对方法调用的时候进行了类校验吗?

@panhongwei
Copy link
Owner

全都有,非static方法反射和jni都有验证类的类型,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants