Skip to main content

Emulite

PyPI Python

Emulite is an emulation framework for Android native libraries, inspired by Unidbg. iOS support is planned.

[!WARNING] Emulite is an early release. Breaking API changes may occur in future releases, and bugs should be expected.

Requirements

  • Python 3.10+
  • Unicorn 2.1.4+
  • Capstone 5+
  • LIEF 0.14+
  • Cryptography 42+

Installation

From PyPI:

pip install emulite

From source:

git clone https://github.com/retrowave3/emulite.git
cd emulite
pip install -e .

Project Status

Supported Platforms

Platform ARM32 ARM64
Android ✅ AndroidEmulator32 ✅ AndroidEmulator64
iOS — ⏳

Supported Engines

Backend Engine Status
Unicorn ✅
Dynarmic —
Apple Silicon Hypervisor —
Linux KVM Hypervisor —

✅ Supported · ⏳ Planned · — Not planned

Examples

See the examples directory.

Android Usage

Use AndroidEmulator32 or AndroidEmulator64 based on the target architecture. A default Android rootfs is included. Pass a path as the first argument to use a custom rootfs.

Every hook returns a HookHandle; call unhook() when the hook is no longer needed. Handles can also be used as context managers when lexical scoping is convenient. Replacement, trace, and memory callbacks use explicit action enums, so callback behavior is visible in both code and type checkers.

from emulite import AndroidEmulator64, AndroidEmulatorBase, JniHandler, JniValue, LogCategory, MemoryAccess, MemoryHookAction, ReplacementAction, TraceAction, TraceInfo
from emulite.android.java.lang.reflect.java_method import JavaMethod


class CustomJniHandler(JniHandler):
    # Unhandled methods raise `NotImplementedError`.
    def call_static_method(self, method: JavaMethod, args: list[object]) -> JniValue:
        if method.java_class.name == "com/example/Device" and method.name == "getValue":
            return "value"
        return super().call_static_method(method, args)


def before_malloc(emu: AndroidEmulatorBase) -> ReplacementAction:
    print("malloc size:", emu.get_argument(0))
    return ReplacementAction.CALL_ORIGINAL


def after_malloc(emu: AndroidEmulatorBase) -> None:
    print("malloc returned:", hex(emu.get_return_value()))


def replace_time(emu: AndroidEmulatorBase) -> ReplacementAction:
    emu.set_return_value(150000)
    return ReplacementAction.SKIP_ORIGINAL


def on_instruction(_emu: AndroidEmulatorBase, info: TraceInfo) -> TraceAction:
    print(info.format())
    return TraceAction.CONTINUE


def on_memory(_emu: AndroidEmulatorBase, access: MemoryAccess, address: int, size: int, value: int) -> MemoryHookAction:
    print(access.name.lower(), hex(address), size, hex(value))
    return MemoryHookAction.CONTINUE


emu = AndroidEmulator64(jni_handler=CustomJniHandler(), log=LogCategory.NONE)

# Load the target ELF and its dependencies
module = emu.load("path/to/libnative.so")

# Run JNI_OnLoad
emu.call_jni_onload(module)

# Call a registered static JNI method
native = emu.java_class("com/example/Native")
result = native.call("getValue", "(I)I", 123)

# Observe malloc before and after the real function runs
malloc_hook = emu.hook_symbol("malloc", before_malloc, after_malloc, module_name=module.name)
result = native.call("getValue", "(I)I", 123)
malloc_hook.unhook()

# Replace time() without calling the original function
time_hook = emu.hook_symbol("time", replace_time, module_name=module.name)
result = native.call("getValue", "(I)I", 123)
time_hook.unhook()

# Trace instructions from the target module
trace = emu.trace_module(on_instruction, module.name)
result = native.call("getValue", "(I)I", 123)
trace.unhook()

# Allocate typed guest memory and observe native access to it
buffer = emu.malloc(32)
buffer.write_cstr("testing")
print(buffer.read_cstr())

watchpoint = emu.watchpoint(int(buffer), on_memory, length=32)
result = module.call_symbol("exported_symbol", int(buffer))
watchpoint.unhook()

emu.free(buffer)
emu.close()

Contributing

Bug reports and pull requests are welcome.

Resources

Metadata

Release files for emulite 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for emulite 0.2.0
File Size Uploaded
emulite-0.2.0.tar.gz 3.0 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for emulite 0.2.0
File Interpreter ABI Platform
emulite-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.1 MB

Release files / emulite-0.2.0.tar.gz

Download URL emulite-0.2.0.tar.gz
Size 3.0 MB
Tags Source
SHA-256 checksum
How to use checksums
d991acbb66d028eb5c6c3ce008a0cc7fcb2bcc61da07469745ad81bcecbdcac2
BLAKE2b-256 checksum
How to use checksums
51af272c0c0a4d8bc4eadf1cb3707e57469908a80d06013c822ce1d3b19efd10
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release files / emulite-0.2.0-py3-none-any.whl

Download URL emulite-0.2.0-py3-none-any.whl
Size 3.1 MB
Tags Python 3
SHA-256 checksum
How to use checksums
a85888eafc53b4af714b1dde70585638f81aedd680dea7690573f49f8137ce6f
BLAKE2b-256 checksum
How to use checksums
b10235c29f9db0220c2a8d32074c0525005fc030239c79cb51519db7794234cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 3, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.0

2 release files

0.3.0

2 release files

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page