sensepost / objection

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

How to set return type of an overloaded function? #601

Open cryptax opened 1 year ago

cryptax commented 1 year ago

I have listed the functions of a class:

com.sedfycutom.pohvtwfxj on (google: 10) [usb] # android hooking list class_methods com.sedfycutom.pohvtwfxj.A
pp
private static synchronized void com.sedfycutom.pohvtwfxj.App.B(com.sedfycutom.pohvtwfxj.App)
private void com.sedfycutom.pohvtwfxj.App.J()
public boolean com.sedfycutom.pohvtwfxj.App.B()
public boolean com.sedfycutom.pohvtwfxj.App.J()
public static com.sedfycutom.pohvtwfxj.App com.sedfycutom.pohvtwfxj.App.B()
public static void com.sedfycutom.pohvtwfxj.App.$r8$lambda$w9PGAmaj4Jum3aVhK8QRhUoePPs(com.sedfycutom.pohvtwfxj.App)
public void com.sedfycutom.pohvtwfxj.App.B()
public void com.sedfycutom.pohvtwfxj.App.onCreate()

I would like to set the return type of "public boolean com.sedfycutom.pohvtwfxj.App.B()". How do I do that? Not that there are other methods B() with no input argument. The different is on the return type.

I tried unsuccessfully:

It answered:

An unexpected internal exception has occurred. If this looks like a code related error, please file a bug report!
script has been destroyed

Python stack trace: Traceback (most recent call last):
  File "/home/axelle/softs/venv/objection-venv/lib/python3.10/site-packages/objection/console/repl.py", line 371, in start_repl
    self.run_command(document)
  File "/home/axelle/softs/venv/objection-venv/lib/python3.10/site-packages/objection/console/repl.py", line 185, in run_command
    exec_method(arguments)
  File "/home/axelle/softs/venv/objection-venv/lib/python3.10/site-packages/objection/commands/android/hooking.py", line 268, in set_method_return_value
    api.android_hooking_set_method_return(class_name,
  File "/home/axelle/softs/venv/objection-venv/lib/python3.10/site-packages/frida/core.py", line 169, in method
    return script._rpc_request("call", js_name, args, **kwargs)
  File "/home/axelle/softs/venv/objection-venv/lib/python3.10/site-packages/frida/core.py", line 76, in wrapper
    return f(*args, **kwargs)
  File "/home/axelle/softs/venv/objection-venv/lib/python3.10/site-packages/frida/core.py", line 368, in _rpc_request
    raise result.error
frida.InvalidOperationError: script has been destroyed

Environment (please complete the following information):