File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change @@ -236,8 +236,10 @@ export async function interceptAndroidFridaTarget(
236236 console . log ( `Intercepting ${ appId } via Android Frida on ${ hostId } ...` ) ;
237237 const deviceClient = adbClient . getDevice ( hostId ) ;
238238
239- await createPersistentReverseTunnel ( deviceClient , proxyPort , proxyPort )
240- . catch ( ( ) => { } ) ; // If we can't tunnel that's OK - we'll use wifi/etc instead
239+ // We try to tunnel the proxy over ADB, but if we can't then that's OK - we'll use wifi/etc instead
240+ const tunnelCreated = await createPersistentReverseTunnel ( deviceClient , proxyPort , proxyPort )
241+ . then ( ( ) => true )
242+ . catch ( ( ) => false )
241243
242244 const fridaStream = await getFridaStream ( hostId , deviceClient ) ;
243245
@@ -255,6 +257,13 @@ export async function interceptAndroidFridaTarget(
255257 '127.0.0.1' ,
256258 ...EMULATOR_HOST_IPS ,
257259 ]
260+ } ) . catch ( ( e ) => {
261+ console . warn ( `Failed to select proxy address for ${ appId } on ${ hostId } : ${ e . message ?? e } ` ) ;
262+
263+ // This can be flaky in some weird cases - when all else fails, we always fallback to the
264+ // ADB reverse tunnel if that's available
265+ if ( tunnelCreated ) return '127.0.0.1'
266+ else throw e ;
258267 } ) ;
259268
260269 const interceptionScript = await buildAndroidFridaScript (
You can’t perform that action at this time.
0 commit comments