1

I'm learning how to use Frida, and would like to do something basic like inject JavaScript into a browser on Windows to list all running tabs. It seems like it should be possible as Frida allows you to

inject snippets of JavaScript into native apps on Windows, Mac, Linux, iOS and Android,

but almost all of the articles online deal with how to use it for Android or iOS and I haven't found anything relevant to my scenario.

If my understanding of the situation is incorrect, please explain why.

2 Answers 2

1

You understand the situation incorrect.

windows.getAll() is JavaScript which the client, in this case, Firefox browser, is evaluating.

Using Frida is injecting JavaScript code into Firefox.

$ cat script.js
Interceptor.attach(Module.findExportByName(null, "PR_Write"), {
    onEnter: function (args) {
        console.log(Memory.readByteArray(args[1], args[2].toInt32() - 1));
    }
});
$ firefox &
[1] 4321
$ frida -p 4321 -l script.js
0  1  2  3  4  5  6  7  8  9  A  B  C  D  E  F  0123456789ABCDEF
00000000  33 62 2f 32 bf eb 00 00 00 03 00 00 00 03 5c 90  3b/2..........\.
00000010  f5 48 5c 90 f5 48 40 2a ec a1 5e 6a 82 e6 00 00  .H\..H@*..^j....
00000020  00 46 00 00 00 00 3a 68 74 74 70 73 3a 2f 2f 77  .F....:https://w
00000030  77 77 2e 67 73 74 61 74 69 63 2e 63 6f 6d 2f 72  ww.gstatic.com/r

You can also invoke functions manually, override & intercept (inject code before & after execution).

1

There are plenty examples of using Frida on Windows:

To your question, the general idea behind Frida is the same regardless of the platform where you have to make yourself familiar with Frida API and write scripts to analyzed hooked functions according to a platform you are working on. For the most part you will be fine using JS based API which enables to call native functions of a particular platform. @Iddo example demonstrates it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.