Skip to content

Hooking to Context doesn't work #67

@afjoseph

Description

@afjoseph

Hey. I ran into a small issue during instrumentation. Hooking into this function of context simply doesn't work. I wanted to know if the issue is on my side.

python script

import frida, sys
import time

jscode = """

Java.perform(function() {
    var context = Java.use("android.content.Context");

    context.openFileOutput.implementation = function(a, b) {
        console.log("Hello world");
        this.openFileOutput(a, b);
    }

});

"""

device = frida.get_usb_device()

pid = device.spawn(["com.whatever.bbb"])
session = device.attach(pid)
script = session.create_script(jscode)

device.resume(pid)
script.load()
print('[*] Running...')
sys.stdin.read()

The app is running and the frida-server is running on the android emulator. I'm sure that this piece of code is being called since I have the source code. The issue is that it is never hooked. Am I doing something wrong here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions