Android - Ndk Shared Libraries Extracting Relevant Jni Hooks With Nm / Objdump
I'm trying to extract the relevant symbols from a shared library that contains JNI glue code, but nm doesn't seem to help enough. The method signatures aren't there so I don't know
Solution 1:
As JNI use C calling convention (cdecl), there are no arguments information in the function signature. You need to analysis the corresponding java(dalvik) code to find out the arguments type.
Here is my jni library:
00001408 g DF .text0000000a Java_info_kghost_android_openvpn_FileDescriptorHolder_close
00001a14 g DF .text00000198 Java_info_kghost_android_openvpn_ManagementSocket_read__ILjava_nio_ByteBuffer_2II
00001414 g DF .text0000000c Java_info_kghost_android_openvpn_ManagementSocket_shutdown
000017c4 g DF .text00000250 Java_info_kghost_android_openvpn_ManagementSocket_read__ILjava_nio_ByteBuffer_2IILinfo_kghost_android_openvpn_FileDescriptorHolder_2
0000142c g DF .text00000200 Java_info_kghost_android_openvpn_ManagementSocket_write__ILjava_nio_ByteBuffer_2IILinfo_kghost_android_openvpn_FileDescriptorHolder_2
00001420 g DF .text0000000a Java_info_kghost_android_openvpn_ManagementSocket_close
0000162c g DF .text00000198 Java_info_kghost_android_openvpn_ManagementSocket_write__ILjava_nio_ByteBuffer_2II
00001bd4 g DF .text000000d4 Java_info_kghost_android_openvpn_ManagementSocket_open
if there is no overload method, the signature won't contain arguments information; if the method is overloaded, the signature will contain arguments information in function name.
And you need to load the jni library explicitly before using the native method:
System.loadLibrary("your-library-name");
Make sure your library is placed inside LD_LIBRARY_PATH
, /lib
directory on Android, check the mmap (/proc/pid/maps
) to see if it is loaded successful.
Post a Comment for "Android - Ndk Shared Libraries Extracting Relevant Jni Hooks With Nm / Objdump"