Skip to content

Commit

Permalink
Can't grep on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
baltpeter committed Apr 13, 2023
1 parent c4502ba commit bed52e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
4 changes: 2 additions & 2 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ An ID of a known permission on Android.

#### Defined in

[android.ts:769](https://github.com/tweaselORG/appstraction/blob/main/src/android.ts#L769)
[android.ts:765](https://github.com/tweaselORG/appstraction/blob/main/src/android.ts#L765)

___

Expand Down Expand Up @@ -274,7 +274,7 @@ The IDs of known permissions on Android.

#### Defined in

[android.ts:638](https://github.com/tweaselORG/appstraction/blob/main/src/android.ts#L638)
[android.ts:634](https://github.com/tweaselORG/appstraction/blob/main/src/android.ts#L634)

___

Expand Down
10 changes: 3 additions & 7 deletions src/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,20 +141,16 @@ export const androidApi = <RunTarget extends SupportedRunTarget<'android'>>(
}

// Start `frida-server` if it's not already running.
const fridaCheck = await execa(`frida-ps -U | grep frida-server`, {
shell: true,
reject: false,
});
if (fridaCheck.exitCode === 0) return;
const { stdout: fridaCheck } = await execa('frida-ps', ['-U'], { reject: false });
if (fridaCheck.includes('frida-server')) return;

await this.requireRoot('Frida');

await execa('adb', ['shell', 'chmod', '755', '/data/local/tmp/frida-server']);
await execa('adb', ['shell', '-x', '/data/local/tmp/frida-server', '--daemonize']);

const fridaIsStarted = await retryCondition(
async () =>
(await execa(`frida-ps -U | grep frida-server`, { shell: true, reject: false })).exitCode === 0,
async () => (await execa('frida-ps', ['-U'], { reject: false })).stdout.includes('frida-server'),
100
);
if (!fridaIsStarted) throw new Error('Failed to start Frida.');
Expand Down

0 comments on commit bed52e6

Please sign in to comment.