Giter VIP home page Giter VIP logo

Comments (4)

Piasy avatar Piasy commented on August 26, 2024 1

With Frida 10.0.10, Android 6.0.0, I can hook constructor with code below:

function print_args() {
    var str = "";
    for (var i = 0; i < arguments.length; i++) {
        str += arguments[i] + ", "
    }
    return str;
}

Java.perform(function () {
    var AudioRecord = Java.use("android.media.AudioRecord");

    AudioRecord.$init.overload("int", "int", "int", "int", "int").implementation = function (audioSource, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes) {
        send("android.media.AudioRecord(" + this + ").<init>: " + print_args(audioSource, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes));
        return this.$init(audioSource, sampleRateInHz, channelConfig, audioFormat, bufferSizeInBytes);
    };
});

If I use $new, it will give such error message: Error: Reimplementing $new is not possible. Please replace implementation of $init instead., so I use $init, and it works.

from frida-gum.

pandasauce avatar pandasauce commented on August 26, 2024

Ran into this same issue. Interestingly enough, depending on the way I hook it the results vary.

$new.overloads[i] will crash the app.

$new.overload() with apply(this, arguments) as the last line will freeze it with a black screen.

$new.overload() with anything else will crash the app.

from frida-gum.

su-vikas avatar su-vikas commented on August 26, 2024

I encountered the same problem on Android 6.0.1, with Frida 8.1.13. When I try to attach to a constructor of a Java class, the application crashes.

from frida-gum.

oleavr avatar oleavr commented on August 26, 2024

Thanks for pointing this out, @Piasy!

from frida-gum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.