sensepost / objection

📱 objection - runtime mobile exploration
GNU General Public License v3.0
7.36k stars 844 forks source link

Cant connect to different port #185

Open GOAT-FARM3R opened 5 years ago

GOAT-FARM3R commented 5 years ago

Objection fails to connect to frida-server on the non standard port when connected via USB.

Started frida-server with: ./frida-server-12.3.1-android-arm -l 0.0.0.0:50005

Started objection with: objection -p 50005 -g [REDACTED] explore

Stack trace from objection:

Traceback (most recent call last):
  File "/usr/bin/objection", line 11, in <module>
    load_entry_point('objection==1.4.3', 'console_scripts', 'objection')()
  File "/usr/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.7/site-packages/objection/console/cli.py", line 78, in explore
    r.run_command(command)
  File "/usr/lib/python3.7/site-packages/objection/console/repl.py", line 200, in run_command
    exec_method(arguments)
  File "/usr/lib/python3.7/site-packages/objection/commands/android/hooking.py", line 280, in set_method_return_value
    runner.run_as_job(name='set-return-value', args=args)
  File "/usr/lib/python3.7/site-packages/objection/utils/frida_transport.py", line 380, in run_as_job
    job.session = self.get_session()
  File "/usr/lib/python3.7/site-packages/objection/utils/frida_transport.py", line 285, in get_session
    return device.attach(state_connection.gadget_name)
  File "/usr/lib/python3.7/site-packages/frida/core.py", line 110, in attach
    return Session(self._impl.attach(self._pid_of(target)))
  File "/usr/lib/python3.7/site-packages/frida/core.py", line 128, in _pid_of
    return self.get_process(target).pid
  File "/usr/lib/python3.7/site-packages/frida/core.py", line 69, in get_process
    matching = [process for process in self._impl.enumerate_processes() if fnmatch.fnmatchcase(process.name.lower(), process_name_lc)]
frida.ServerNotRunningError: unable to connect to remote frida-server: closed
aph3rson commented 5 years ago

Were you using the --startup-command option?

aph3rson commented 5 years ago

Also, I believe you're missing the --network and --host options in your example. Are you also missing those in your objection arguments?