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

After a long period of hooking applications on Ubuntu, Python and JavaScript are unable to interact. #246

Open
CGxyol opened this issue Jul 31, 2024 · 0 comments

Comments

@CGxyol
Copy link

CGxyol commented Jul 31, 2024

Long-term hooking in Ubuntu causes the Python script to be unable to print logs from Frida and receive remote calls from Frida.
The scenario involves hooking into an IL2CPP Unity game on Ubuntu, but after running for a while, the aforementioned problem occurs. Python continues to run, and Frida is also hooking into the application normally, but there is no interaction between the two.

main

if __name__ == '__main__':
    manager = frida.get_device_manager()
    device = manager.get_local_device()
    pid = device.spawn(['my-application'])
    process = device.attach(pid)
    script = process.create_script(test_js)
    script.on('message', on_message)

    t1 = Thread(target=reportMatch)
    t1.start()
    print('[*] Running')
    script.load()
    device.resume(pid)
    sys.stdin.read()

python handle send function

if message['type'] == 'send':
        data = "{0}".format(message['payload'])
        if message['payload']["type"] == "sendCount":
            playersCount = message['payload']['count']
            print(playersCount)

js handle handleGetCount function

recv("getPlayersCount", handleGetCount);

    function handleGetCount() {
        recv("getPlayersCount", handleGetCount);
       //some function to get count
        send(new countData(count + "/" + maxCount));

    }

There is continuous interaction between them; Python calls a method in JavaScript every 5 seconds to retrieve some content, so there is no long period of inactivity. However, the situation mentioned above still occurs where it seems like Python and Frida have lost connection, yet they are both running normally without any exceptions. It is hoped that this issue can be resolved.
python version:3.10.12
frida version:16.4.7

The hook is for a local application, not a remote call, so theoretically, there should be no network-related reasons.
I'm looking forward to resolving this issue. If necessary, you can provide your email address to me, and I can provide more information. This issue is really troubling me~

@CGxyol CGxyol changed the title Long-term hooking in Ubuntu causes the Python script to be unable to print logs from Frida and receive remote calls from Frida. After a long period of hooking applications on Ubuntu, Python and JavaScript are unable to interact. Jul 31, 2024
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

1 participant