File tree Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Expand file tree Collapse file tree 3 files changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -16,6 +16,7 @@ import {
16
16
FRIDA_DEFAULT_PORT ,
17
17
FRIDA_VERSION ,
18
18
FridaHost ,
19
+ killProcess ,
19
20
launchScript ,
20
21
testAndSelectProxyAddress
21
22
} from './frida-integration' ;
@@ -210,7 +211,7 @@ export async function interceptAndroidFridaTarget(
210
211
console . log ( `Frida Android interception started: ${ appId } on ${ hostId } forwarding to ${ proxyIp } :${ proxyPort } ` ) ;
211
212
} catch ( e ) {
212
213
// If anything goes wrong, just make sure we shut down the app again
213
- await session . kill ( ) ;
214
+ await killProcess ( session ) . catch ( console . log )
214
215
throw e ;
215
216
}
216
217
}
Original file line number Diff line number Diff line change 1
1
import * as FridaJs from 'frida-js' ;
2
- import { CustomError } from '@httptoolkit/util' ;
2
+ import { CustomError , delay } from '@httptoolkit/util' ;
3
3
4
4
import { getReachableInterfaces } from '../../util/network' ;
5
5
import { buildIpTestScript } from './frida-scripts' ;
@@ -55,6 +55,15 @@ class FridaProxyError extends CustomError {
55
55
}
56
56
}
57
57
58
+ export async function killProcess ( session : FridaJs . FridaAgentSession ) {
59
+ // We have to resume and then wait briefly before we can kill:
60
+ await session . resume ( )
61
+ . then ( ( ) => delay ( 100 ) ) // Even 0 seems to work - but let's be safe
62
+ . catch ( ( ) => { } ) ;
63
+
64
+ await session . kill ( ) ;
65
+ }
66
+
58
67
export async function testAndSelectProxyAddress (
59
68
session : FridaJs . FridaAgentSession ,
60
69
proxyPort : number ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { buildIosFridaScript } from './frida-scripts';
6
6
import {
7
7
FRIDA_DEFAULT_PORT ,
8
8
FridaHost ,
9
+ killProcess ,
9
10
launchScript ,
10
11
testAndSelectProxyAddress
11
12
} from './frida-integration' ;
@@ -127,7 +128,7 @@ export async function interceptIosFridaTarget(
127
128
console . log ( `Frida iOS interception started: ${ appId } on ${ hostId } forwarding to ${ proxyIp } :${ proxyPort } ` ) ;
128
129
} catch ( e ) {
129
130
// If anything goes wrong, just make sure we shut down the app again
130
- await session . kill ( ) ;
131
+ await killProcess ( session ) . catch ( console . log ) ;
131
132
throw e ;
132
133
}
133
134
}
You can’t perform that action at this time.
0 commit comments