frida / frida-node

Frida Node.js bindings
282 stars 66 forks source link

[Example] How to read a file from gadget / agent #58

Closed c128128 closed 4 years ago

c128128 commented 4 years ago

Hi there, are there any good examples how to read a file from gadget / agent ? I already tried frida-fs but, I haven't understood how to do it.

Thanks.

oleavr commented 4 years ago

Grab frida-agent-example and use the Node.js fs module as if you were targeting Node.js, and frida-compile will plug in the frida-fs shim automatically. This is how you can already use thousands of existing packages from npm whether they're written for Node.js, the web, or Frida.

One tip that might save you some grief: You can use promisify() from Node.js' util module to wrap fs functions so they can be awaited from an async function. That way you won't have to deal with callback spaghetti.

c128128 commented 4 years ago

Thanks @oleavr,

Let me clarify my question. I want to transfer files from device to macos, I know I can use something like scp, but I am connected using USB. I mean something like this example.

My first idea was to create a HTTP server on device, and than from local request files that I need, but maybe there are other methods.

P.S: I am new to frida and not really familiar with terminologies. What I know is that script that will be executed on device is called in most cases agent, but how you call local script ?