File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
binder_trace/binder_trace Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -56,10 +56,18 @@ def __init__(
5656
5757 def start (self ):
5858 """Start the injector."""
59- if self .spawn_process :
60- self .device .spawn ([self .process_identifier ])
59+ # Frida can behave weirdly if you attempt to spawn a package which is already running
60+ # so first try to attach, and if it fails and spawn option supplied, spawn it.
61+ try :
62+ self .session = self .device .attach (self .process_identifier )
63+ except frida .ProcessNotFoundError :
64+ if self .spawn_process :
65+ self .device .spawn ([self .process_identifier ])
66+ self .start ()
67+ return
68+ else :
69+ raise
6170
62- self .session = self .device .attach (self .process_identifier )
6371 self .script = self .session .create_script (self .script_content )
6472 self .script .on ("message" , self ._message_handler )
6573
You can’t perform that action at this time.
0 commit comments