Frida Hook Native Function (stringFromJNI)

Oct. 29, 2020 // echel0n

Here is an example for how you can hook native library.


  1. 'use strict';
  2. console.log("[*] Script is running");
  3. global.run = function () {
  4. Java.perform(function () {
  5. var example_class = Java.use("<the_class_which_is_callin_jni>");
  6. example_class.stringFromJNI.implementation = function() {
  7. console.log("[!] Inside in implementation");
  8. var ret = this.stringFromJNI();
  9. console.log("ret="+ret);
  10. return ret;
  11. }
  12. console.log("[!] DONE");
  13. });
  14. };