2

Referring the Frida tutorial.

public class MainActivity extends AppCompatActivity {

    static {
        System.loadLibrary("native-lib");
    }

    public native int Jniint();

In the tutorial Frida is used to intercept the call to the JNI method Jniint().

Activity.Jniint.implementation = function () {
    // console.log is used to report information back to us
    console.log("Inside Jniint now...");
    // return this number of our choice
    return 80085
  };

I know Xposed can be used to hook Java methods and not native code, but is it also allowed to intercept calls to native methods (using findAndHookMethod) like Frida so that it can block any actual native code from an app to be executed and just return dummy result ?

Jake
  • 16,329
  • 50
  • 126
  • 202
  • According to an old [post on XDA](https://forum.xda-developers.com/t/q-can-xposed-hook-native-methods.2817927/) this is possible however the hook has to be installed after the `System.loadLibrary` call has been executed, otherwise the hook will be overwritten. – Robert May 10 '22 at 09:02
  • @Robert I did some more search .. check this https://github.com/rovo89/XposedBridge/issues/177 .. can we assume this github post confirms it ? – Jake May 10 '22 at 19:27
  • Based on that post I would say it looks good for you. But you have to keep in mind that most likely you are using EdXposed instead of Xposed, and the first is just an compatibility layer that mimics Xposed based on Riru. I wouldn't be surprised if there are minor differences between Xposed an EdXposed... – Robert May 10 '22 at 20:40

0 Answers0