SReverseby Simpa Labs

Compiled Python

Recovering API logic from Cython modules inside an Android app

An Android app can keep its request logic in compiled Python extensions. Follow the Python wrapper and native module together to rebuild the requests, signatures and sessions in a client you can run.

Identify the module and its runtime

Inspect the APK set for the Python runtime, Python files and native extensions for the device’s ABI. A file ending in .so is a shared library; that suffix alone does not identify Cython. Check its imports, initialization functions and the Python code that loads it.

Cython’s compilation guide describes the two stages: Python or Cython source becomes C or C++, then a native extension. Python 3 extension modules use an initialization entry point such as PyInit_request_module. Packing, symbol visibility and embedding choices affect what remains visible in a shipped app.

Follow the wrapper to the bytes sent

Start at the code that performs the business action. It can collect values in Python, pass them to a compiled helper and send the result through another library. Reading only the extension misses the surrounding session state; reading only the wrapper misses the compiled transformation.

Track the input type at each boundary. Python strings need an encoding before they become request bytes. A Python integer can also enter a fixed-width C type. Record the exact body after encoding, then compare it with the app’s outgoing request.

A compiled module you can inspect

The owned Cython example exposes two methods: request_bytes builds a small JSON body and sign signs that body with a public HMAC test key. The example is compiled on the host and checked against Python’s standard library. It demonstrates the wrapper-to-native boundary, not an Android device run.

body = request_module.request_bytes("demo", 7)
assert body == b'{"sku":"demo","count":7}'
digest = request_module.sign(body)

Inspect the compiled extension’s exported initialization symbol, then follow calls and constants from the exposed functions. Names and constants help locate the routine. The matching output proves the fixture’s byte behavior.

Separate recoverable names from recovered behavior

Generated C contains Python runtime calls, error paths and reference handling alongside business logic. A long decompiled function therefore includes work unrelated to the API. Use a known request to identify which values reach serialization, compression, encryption or signing.

A module name or readable endpoint string is a starting point. Confirm which function uses it, which arguments change it and which response follows. For byte-level comparisons, retain request bodies as binary files rather than copying a formatted view from a proxy.

Build the result around the buyer’s task

The complete client needs the same session refresh, request order and response parsing as the app. Recovered compiled helpers become ordinary parts of that client. A buyer who needs daily stock data should be able to call a stock method and receive usable records.

Keep test vectors beside the rebuilt helper so later updates reveal whether the change is in body formatting, signing inputs or session state. Native request boundaries and encrypted API payloads cover related paths. Native Android API reconstruction turns that analysis into the working delivery.

Reviewed 22 October 2026 · SReverse research desk

Start your full APK reconstruction

Send the full APK

Projects start at $70. Choose WhatsApp or email, then attach the APK in the app that opens. We reply within one hour with the next step and send the fixed quote after review.

Want us to contact you?