Skip to content

Commit

Permalink
Fixes #32: Retry starting Frida if it fails
Browse files Browse the repository at this point in the history
  • Loading branch information
baltpeter authored and zner0L committed Mar 28, 2023
1 parent 7e2b48b commit 6325184
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 4 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:639](https://github.com/tweaselORG/platform-apis/blob/main/src/android.ts#L639)
[android.ts:640](https://github.com/tweaselORG/platform-apis/blob/main/src/android.ts#L640)

___

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

#### Defined in

[android.ts:508](https://github.com/tweaselORG/platform-apis/blob/main/src/android.ts#L508)
[android.ts:509](https://github.com/tweaselORG/platform-apis/blob/main/src/android.ts#L509)

___

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
"frida": "^16.0.8",
"fs-extra": "^11.1.0",
"ipa-extract-info": "^1.2.6",
"p-retry": "^5.1.2",
"pkijs": "^3.0.14",
"tempy": "^3.0.0",
"ts-node": "^10.9.1"
Expand Down
5 changes: 3 additions & 2 deletions src/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import fetch from 'cross-fetch';
import { execa } from 'execa';
import frida from 'frida';
import { rm, writeFile } from 'fs/promises';
import pRetry from 'p-retry';
import { temporaryFile } from 'tempy';
import type {
PlatformApi,
Expand Down Expand Up @@ -59,7 +60,7 @@ export const androidApi = <RunTarget extends SupportedRunTarget<'android'>>(

await this.requireRoot('Frida');

await execa('adb shell "nohup /data/local/tmp/frida-server >/dev/null 2>&1 &"', { shell: true });
await execa('adb', ['shell', '-x', '/data/local/tmp/frida-server', '--daemonize']);

const fridaIsStarted = await retryCondition(
async () =>
Expand Down Expand Up @@ -133,7 +134,7 @@ export const androidApi = <RunTarget extends SupportedRunTarget<'android'>>(
);
});

await this._internal.ensureFrida();
await pRetry(() => this._internal.ensureFrida());

if (options.capabilities.includes('wireguard')) {
// Install app if necessary.
Expand Down
18 changes: 18 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -971,6 +971,11 @@
resolved "https://registry.yarnpkg.com/@types/promise-timeout/-/promise-timeout-1.3.0.tgz#90649ff6f48c1ead9de142e6dd9f62f8c5a54022"
integrity sha512-AtVKSZUtpBoZ4SshXJk5JcTXJllinHKKx615lsRNJUsbbFlI0AI8drlnoiQ+PNvjkeoF9Y8fJUh6UO2khsIBZw==

"@types/[email protected]":
version "0.12.1"
resolved "https://registry.yarnpkg.com/@types/retry/-/retry-0.12.1.tgz#d8f1c0d0dc23afad6dc16a9e993a0865774b4065"
integrity sha512-xoDlM2S4ortawSWORYqsdU+2rxdh4LRW9ytc3zmT37RIKQh6IHyKwwtKhKis9ah8ol07DCkZxPt8BBvPjC6v4g==

"@types/semver@^7.3.12":
version "7.3.13"
resolved "https://registry.yarnpkg.com/@types/semver/-/semver-7.3.13.tgz#da4bfd73f49bd541d28920ab0e2bf0ee80f71c91"
Expand Down Expand Up @@ -3603,6 +3608,14 @@ p-map@^4.0.0:
dependencies:
aggregate-error "^3.0.0"

p-retry@^5.1.2:
version "5.1.2"
resolved "https://registry.yarnpkg.com/p-retry/-/p-retry-5.1.2.tgz#c16eaee4f2016f9161d12da40d3b8b0f2e3c1b76"
integrity sha512-couX95waDu98NfNZV+i/iLt+fdVxmI7CbrrdC2uDWfPdUAApyxT4wmDlyOtR5KtTDmkDO0zDScDjDou9YHhd9g==
dependencies:
"@types/retry" "0.12.1"
retry "^0.13.1"

[email protected]:
version "2.8.2"
resolved "https://registry.yarnpkg.com/parcel/-/parcel-2.8.2.tgz#6539c0a435b14e5829d09254b0394dcfbc0b0ba5"
Expand Down Expand Up @@ -3967,6 +3980,11 @@ restore-cursor@^3.1.0:
onetime "^5.1.0"
signal-exit "^3.0.2"

retry@^0.13.1:
version "0.13.1"
resolved "https://registry.yarnpkg.com/retry/-/retry-0.13.1.tgz#185b1587acf67919d63b357349e03537b2484658"
integrity sha512-XQBQ3I8W1Cge0Seh+6gjj03LbmRFWuoszgK9ooCpwYIrhhoO80pfq4cUkU5DkknwfOfFteRwlZ56PYOGYyFWdg==

reusify@^1.0.4:
version "1.0.4"
resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76"
Expand Down

0 comments on commit 6325184

Please sign in to comment.