Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- This function is used to create a hook on all the methods described in
- the following class:
- package_name.class_name
- The hook will not modify the functionality of the methods but only
- print out the provided parameters and the result returned every time
- a method is called.
- Arguments:
- package_name - The package name of the class the method is in
- class_name - The class name of the class the method is in
- */
- function monitorClass(package_name, class_name) {
- var full_class_name = package_name + '.' + class_name;
- const cls = Java.use(full_class_name);
- const funcs = Object.getOwnPropertyNames(cls.$classWrapper.prototype);
- for (var f in funcs) {
- try {
- var func_name = funcs[f];
- send("Hooking class: " + class_name + " Function: " + func_name + "\n");
- monitorFunction(package_name, class_name, func_name);
- }
- catch(e) {
- send("Failed hooking class: " + class_name + " Function: " + func_name + "\n");
- }
- }
- }
- if (Java.available) {
- Java.perform(function() {
- // monitorFunction('<package-name>', '<class-name>', '<func-name>');
- // monitorClass('<package-name>', '<class-name>');
- });
- }
Add Comment
Please, Sign In to add comment