zhkl0228 / unidbg

Allows you to emulate an Android native library, and an experimental iOS emulation
Apache License 2.0
3.88k stars 966 forks source link

某app里native层调用了app里面Java层的方法,抛出了异常。我把此app要调用的相关类都复制到本项目,路径名也保持一致,还是出错。请问是什么原因呢? #174

Open JcLouris opened 4 years ago

JcLouris commented 4 years ago

[19:37:36 882] WARN [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:440) - handleInterrupt intno=2, NR=-1073744008, svcNumber=0x12c, PC=unicorn@0xfffe0354[libjnigraphics.so]0x354, syscall=null java.lang.UnsupportedOperationException: com/xxxapp/main/data/enumerable/User->ach(Ljava/lang/String;)Ljava/lang/String; at com.github.unidbg.linux.android.dvm.AbstractJni.callStaticObjectMethod(AbstractJni.java:335) at com.github.unidbg.linux.android.dvm.DvmMethod.callStaticObjectMethod(DvmMethod.java:29) at com.github.unidbg.linux.android.dvm.DalvikVM$45.handle(DalvikVM.java:970) at com.github.unidbg.linux.ARM32SyscallHandler.hook(ARM32SyscallHandler.java:103) at unicorn.Unicorn$NewHook.onInterrupt(Unicorn.java:128) at unicorn.Unicorn.emu_start(Native Method) at com.github.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:357) at com.github.unidbg.AbstractEmulator.eFunc(AbstractEmulator.java:445) at com.github.unidbg.arm.AbstractARMEmulator.eFunc(AbstractARMEmulator.java:206) at com.github.unidbg.Module.emulateFunction(Module.java:154) at com.github.unidbg.linux.android.dvm.DvmObject.callJniMethod(DvmObject.java:110) at com.github.unidbg.linux.android.dvm.DvmClass.callStaticJniMethod(DvmClass.java:223) at com.xxxapp.main.data.enumerable.Utilities64.getSign(Utilities64.java:86) at com.xxxapp.main.data.enumerable.Utilities64.main(Utilities64.java:58) [19:37:36 894] WARN [com.github.unidbg.AbstractEmulator] (AbstractEmulator:376) - emulate RX@0x40002405[libsalt.so]0x2405 exception sp=unicorn@0xbffff750, msg=com/xxxapp/main/data/enumerable/User->ach(Ljava/lang/String;)Ljava/lang/String;, offset=97288ms destroy

JcLouris commented 4 years ago

看了下别人issue里的回答,是因为本项目不支持native层调用java层的函数吗?

10code15bugs commented 4 years ago

[19:37:36 882] WARN [com.github.unidbg.linux.ARM32SyscallHandler] (ARM32SyscallHandler:440) - handleInterrupt intno=2, NR=-1073744008, svcNumber=0x12c, PC=unicorn@0xfffe0354[libjnigraphics.so]0x354, syscall=null java.lang.UnsupportedOperationException: com/xxxapp/main/data/enumerable/User->ach(Ljava/lang/String;)Ljava/lang/String; at com.github.unidbg.linux.android.dvm.AbstractJni.callStaticObjectMethod(AbstractJni.java:335) at com.github.unidbg.linux.android.dvm.DvmMethod.callStaticObjectMethod(DvmMethod.java:29) at com.github.unidbg.linux.android.dvm.DalvikVM$45.handle(DalvikVM.java:970) at com.github.unidbg.linux.ARM32SyscallHandler.hook(ARM32SyscallHandler.java:103) at unicorn.Unicorn$NewHook.onInterrupt(Unicorn.java:128) at unicorn.Unicorn.emu_start(Native Method) at com.github.unidbg.AbstractEmulator.emulate(AbstractEmulator.java:357) at com.github.unidbg.AbstractEmulator.eFunc(AbstractEmulator.java:445) at com.github.unidbg.arm.AbstractARMEmulator.eFunc(AbstractARMEmulator.java:206) at com.github.unidbg.Module.emulateFunction(Module.java:154) at com.github.unidbg.linux.android.dvm.DvmObject.callJniMethod(DvmObject.java:110) at com.github.unidbg.linux.android.dvm.DvmClass.callStaticJniMethod(DvmClass.java:223) at com.xxxapp.main.data.enumerable.Utilities64.getSign(Utilities64.java:86) at com.xxxapp.main.data.enumerable.Utilities64.main(Utilities64.java:58) [19:37:36 894] WARN [com.github.unidbg.AbstractEmulator] (AbstractEmulator:376) - emulate RX@0x40002405[libsalt.so]0x2405 exception sp=unicorn@0xbffff750, msg=com/xxxapp/main/data/enumerable/User->ach(Ljava/lang/String;)Ljava/lang/String;, offset=97288ms destroy

请问解决了吗 so层反射调用java层的方法 这种怎么模拟

zhkl0228 commented 4 years ago

vm.setDvmClassFactory(new ProxyClassFactory());