Allows you to partly emulate an Android native library.
This is an educational project to learn more about the ELF file format and Unicorn.
- Emulation of the JNI Invocation API so
JNI_OnLoad
can be called properly. - Emulation of native memory for malloc / memcpy.
- Emulation of syscalls (SVC #0) instruction.
- Hooking through the symbol table.
- All JavaVM, JNIEnv and hooked functions are handled by python.
- Enable VFP support.
In the future this will be possible through pypi.
Make sure you are using python 3.7.
- Clone the repository
- Run
pip install -r requirements.txt
- Run
python example.py
If you have trouble getting the
keystone-engine
dependency on Windows (as I did):
- Clone their repository
- Open a terminal in
bindings/python
- Run
python setup.py install
(Make sure you are using python 3.7)- Download their
Windows - Core engine
package here for your python arch.- Put the
keystone.dll
inC:\location_to_python\Lib\site-packages\keystone\
.
- Improve file descriptors in
vfs/file_system.py
so they are re-useable. - Add a way for the VirtualFileSystem to give back dynamic files, such as
/proc/self/status
,/proc/self/status
but also/dev/urandom
. - Library consumers must be able to easily rebuild the needed Java classes for a native library, which are used by the native library through the JNIEnv.
ClassesObjectsMethodsNative methods- Fields
- Types
- Reflection
All resources used while developing AndroidNativeEmu.
- https://greek0.net/elf.html
- https://stackoverflow.com/questions/13908276/loading-elf-file-in-c-in-user-space
- https://programtalk.com/python-examples/pyelftools.elftools.elf.relocation.Relocation/
- http://infocenter.arm.com/help/topic/com.arm.doc.ihi0044f/IHI0044F_aaelf.pdf
- https://wiki.osdev.org/ELF_Tutorial
- https://docs.oracle.com/javase/7/docs/technotes/guides/jni/spec/functions.html
- https://android.googlesource.com/platform/dalvik/+/donut-release/vm/Jni.c
- https://github.com/lunixbochs/usercorn
- https://github.com/slick1015/pad_unpacker (SVC 0 instruction)