Skip to content

Commit

Permalink
Don't send argv with spawn if set to undefined
Browse files Browse the repository at this point in the history
This is important as argv is not supported when spawning Android apps,
and so this must be set to false.
  • Loading branch information
pimterry committed Jun 14, 2023
1 parent f65fa0e commit 06e7fe4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion README.md
Expand Up @@ -145,10 +145,12 @@ Injects a given Frida script into a target process, specified by PID. Returns a

Injects real JavaScript into Node.JS processes specifically. Rather than requiring a full Frida script, this takes any normal JS script, and conveniently wraps it with a script to inject it into the V8 event loop for you, so you can just write JS and run it in a target directly.

### `fridaClient.spawnWithScript(command: string, args: string[], script: string)`
### `fridaClient.spawnWithScript(command: string, args: string[] | undefined, script: string)`

Takes a command to run and arguments, launches the process via Frida, injects the given Frida script before it starts, and then resumes the process.

Note that to launch apps on Android, `command` should be a package name like `com.android.dialer` and `args` must be undefined.

### `fridaClient.disconnect()`

When you're done, it's polite to disconnect from Frida. This returns a promise which resolves once the WebSocket connection has been closed.
Expand Down
6 changes: 4 additions & 2 deletions src/index.ts
Expand Up @@ -129,11 +129,13 @@ export class FridaSession {
return this.injectIntoProcess(pid, fridaScript);
}

async spawnWithScript(command: string, args: string[], fridaScript: string) {
async spawnWithScript(command: string, args: string[] | undefined, fridaScript: string) {
const hostSession: any = await this.getHostSession();

const pid = await hostSession.Spawn(command, [
true, [command, ...args],
...(args
? [true, [command, ...args]]
: [false, []]),
false, [],
false, [],
"",
Expand Down

0 comments on commit 06e7fe4

Please sign in to comment.