-
Notifications
You must be signed in to change notification settings - Fork 78
Description
实验机器:nexus 6
系统:android 6
测试代码:
try {
Class<?> posixClass = getClassLoader().loadClass("libcore.io.Posix");
HookManager.findAndHookMethod(posixClass, "readBytes", FileDescriptor.class, Object.class, int.class, int.class, new MethodCallback() {
@OverRide
protected void beforeHookedMethod(MethodHookParam param) throws Throwable {
//Log.d("xela", Log.getStackTraceString(new Throwable()));
}
@Override
protected void afterHookedMethod(MethodHookParam param) throws Throwable {
Log.d("panda", "============== readBytes");
}
});
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
}
运行效果:
10-24 15:28:53.555 29325 29347 F libc : Fatal signal 11 (SIGSEGV), code 1, fault addr 0x0 in tid 29347 (Thread-2421)
10-24 15:28:53.609 381 381 F DEBUG : *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
10-24 15:28:53.610 381 381 F DEBUG : Build fingerprint: 'google/shamu/shamu:6.0.1/MMB30R/3031534:user/release-keys'
10-24 15:28:53.610 381 381 F DEBUG : Revision: '0'
10-24 15:28:53.610 381 381 F DEBUG : ABI: 'arm'
10-24 15:28:53.611 381 381 F DEBUG : pid: 29325, tid: 29347, name: Thread-2421 >>> com.panda.hook.andhook <<<
10-24 15:28:53.611 381 381 F DEBUG : signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0
10-24 15:28:53.635 381 381 W debuggerd: type=1400 audit(0.0:6324): avc: denied { search } for name="com.panda.hook.andhook" dev="dm-1" ino=409029 scontext=u:r:debuggerd:s0 tcontext=u:object_r:app_data_file:s0:c512,c768 tclass=dir permissive=0
10-24 15:28:53.656 381 381 F DEBUG : r0 aa4c5d80 r1 b38d833c r2 b38d8340 r3 b38d8344
10-24 15:28:53.656 381 381 F DEBUG : r4 12e97b2c r5 70ec6578 r6 70ec6578 r7 12ea2110
10-24 15:28:53.656 381 381 F DEBUG : r8 12ed3000 r9 aa263400 sl 00000000 fp 00002000
10-24 15:28:53.657 381 381 F DEBUG : ip 00000000 sp b38d8320 lr 73670bd5 pc 00000000 cpsr 200d0010
10-24 15:28:53.658 381 381 F DEBUG :
10-24 15:28:53.658 381 381 F DEBUG : backtrace:
10-24 15:28:53.658 381 381 F DEBUG : #00 pc 00000000
10-24 15:28:53.658 381 381 F DEBUG : #1 pc 73670bd3 /data/dalvik-cache/arm/system@framework@boot.oat (offset 0x1ec9000)
这个必现!
大神有空的时候看看~
是不是 拦截系统方法不行?