Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Java method hook do not take effect in Android 14 #301

Open
blossomchina opened this issue Oct 24, 2023 · 1 comment
Open

Java method hook do not take effect in Android 14 #301

blossomchina opened this issue Oct 24, 2023 · 1 comment

Comments

@blossomchina
Copy link

Java.use(xxx).implementation = function()
Java.choose(xxx, {})
when Java.use and Java.choose is used in the same time, Java.use(xxx).implementation will not take effect

@AmenAllahGAMER
Copy link

You maybe Used the wrong Class And Method
Because First of all you must Enumerate the classes and Methods using Frida from the Application And after that You look for the right Method With it's True Class Then try hooking them directly So, In your case it's:
Java.use(xxx).implementation = function() Java.choose(xxx, {})

But, make sure that the Class xxx And the function {} Are correctly defined And Available in the target app Or if you are Injecting Custom class as xxx Or function as {} you should use this Script :
`Java.perform(() => {
console.log("[*] Injecting custom class and function into the target app...");

// Create a custom class named 'xxx'
const xxx = Java.registerClass({
    name: 'com.custom.xxx', // Fully qualified class name
    implements: [], // If implementing any interfaces, specify here
    methods: {
        // Define your custom method
        customMethod: [{
            returnType: 'void', // Return type of the method
            argumentTypes: ['java.lang.String'], // Argument types
            implementation: function (arg) {
                console.log(`[+] customMethod called with argument: ${arg}`);
            }
        }],
    }
});

// Inject the custom function `{}` into the target application
const customFunction = function (arg) {
    console.log(`[+] Custom function '{}' called with argument: ${arg}`);
    xxx.$new().customMethod(arg); // Optional: Call the method of 'xxx' class
};

// Test the custom class and function in the injected script
console.log("[*] Testing custom class and function...");
const instance = xxx.$new(); // Create an instance of the custom class
instance.customMethod("Hello from customMethod!"); // Call the custom method
customFunction("Hello from customFunction!"); // Call the custom function

console.log("[*] Injection complete. Custom class and function are ready.");

});`
Also, Please Describe the Nature of the App that you are Modifying and What you want to achieve into it Then I'll be able to Help you further As well into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants