SHARE
TWEET

Untitled

a guest Jan 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /**
  2.     This function is used to create a hook on all the methods described in
  3.     the following class:
  4.     package_name.class_name
  5.  
  6.     The hook will not modify the functionality of the methods but only
  7.     print out the provided parameters and the result returned every time
  8.     a method is called.
  9.  
  10.     Arguments:
  11.     package_name - The package name of the class the method is in
  12.     class_name - The class name of the class the method is in
  13. */
  14. function monitorClass(package_name, class_name) {
  15.     var full_class_name = package_name + '.' + class_name;
  16.     const cls = Java.use(full_class_name);
  17.     const funcs = Object.getOwnPropertyNames(cls.$classWrapper.prototype);
  18.     for (var f in funcs) {
  19.         try {
  20.             var func_name = funcs[f];
  21.             send("Hooking class: " + class_name + " Function: " + func_name + "\n");
  22.             monitorFunction(package_name, class_name, func_name);
  23.         }  
  24.         catch(e) {
  25.             send("Failed hooking class: " + class_name + " Function: " + func_name + "\n");
  26.         }
  27.     }
  28. }
  29.  
  30. if (Java.available) {
  31.     Java.perform(function() {
  32.         // monitorFunction('<package-name>', '<class-name>', '<func-name>');
  33.         // monitorClass('<package-name>', '<class-name>');
  34.     });
  35. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top