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 {
1616 FRIDA_DEFAULT_PORT ,
1717 FRIDA_VERSION ,
1818 FridaHost ,
19+ killProcess ,
1920 launchScript ,
2021 testAndSelectProxyAddress
2122} from './frida-integration' ;
@@ -210,7 +211,7 @@ export async function interceptAndroidFridaTarget(
210211 console . log ( `Frida Android interception started: ${ appId } on ${ hostId } forwarding to ${ proxyIp } :${ proxyPort } ` ) ;
211212 } catch ( e ) {
212213 // If anything goes wrong, just make sure we shut down the app again
213- await session . kill ( ) ;
214+ await killProcess ( session ) . catch ( console . log )
214215 throw e ;
215216 }
216217}
Original file line number Diff line number Diff line change 11import * as FridaJs from 'frida-js' ;
2- import { CustomError } from '@httptoolkit/util' ;
2+ import { CustomError , delay } from '@httptoolkit/util' ;
33
44import { getReachableInterfaces } from '../../util/network' ;
55import { buildIpTestScript } from './frida-scripts' ;
@@ -55,6 +55,15 @@ class FridaProxyError extends CustomError {
5555 }
5656}
5757
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+
5867export async function testAndSelectProxyAddress (
5968 session : FridaJs . FridaAgentSession ,
6069 proxyPort : number ,
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { buildIosFridaScript } from './frida-scripts';
66import {
77 FRIDA_DEFAULT_PORT ,
88 FridaHost ,
9+ killProcess ,
910 launchScript ,
1011 testAndSelectProxyAddress
1112} from './frida-integration' ;
@@ -127,7 +128,7 @@ export async function interceptIosFridaTarget(
127128 console . log ( `Frida iOS interception started: ${ appId } on ${ hostId } forwarding to ${ proxyIp } :${ proxyPort } ` ) ;
128129 } catch ( e ) {
129130 // If anything goes wrong, just make sure we shut down the app again
130- await session . kill ( ) ;
131+ await killProcess ( session ) . catch ( console . log ) ;
131132 throw e ;
132133 }
133134}
You can’t perform that action at this time.
0 commit comments