sledgeh4w / chomper

A lightweight emulation framework for emulating iOS executables and libraries.
MIT License
276 stars 69 forks source link

对继承UIViewController的类进行alloc init会报错. 对继承NSObject的类进行初始化alloc init没问题 #98

Open ljy0jy opened 4 days ago

ljy0jy commented 4 days ago
   result3 = objc.msg_send("NewVcViewController", "alloc")
    NewVcViewController = objc.msg_send(result3,"init")

<> @interface NewVcViewController : UIViewController -(int)simpleTest:(int)a add:(int)b;

+(int)simpleTest_class:(int)a add:(int)b; @end

<>

import "NewVcViewController.h"

@interface NewVcViewController ()

@end

@implementation NewVcViewController

-(int)simpleTest:(int)a add:(int)b{ return a+b; } +(int)simpleTest_class:(int)a add:(int)b { return a+b; }

Traceback (most recent call last): File "/Users/new/Documents/pythonProject/iosRe/.venv/lib/python3.12/site-packages/chomper/core.py", line 207, in _start_emulate self.uc.emu_start(address, stop_addr) File "/Users/new/Documents/pythonProject/iosRe/.venv/lib/python3.12/site-packages/unicorn/unicorn_py3/unicorn.py", line 642, in emu_start raise UcError(status) unicorn.unicorn_py3.unicorn.UcError: Invalid memory fetch (UC_ERR_FETCH_UNMAPPED)

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/Users/new/Documents/learn/iOS逆向/chomper_code/chomper/examples/ios_te.py", line 62, in main() File "/Users/new/Documents/learn/iOS逆向/chomper_code/chomper/examples/ios_te.py", line 51, in main NewVcViewController = objc.msg_send(result3,"init") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/new/Documents/pythonProject/iosRe/.venv/lib/python3.12/site-packages/chomper/objc.py", line 55, in msg_send return self.emu.call_symbol("_objc_msgSend", receiver, sel, new_args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/new/Documents/pythonProject/iosRe/.venv/lib/python3.12/site-packages/chomper/core.py", line 723, in call_symbol return self._start_emulate(address, args) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/new/Documents/pythonProject/iosRe/.venv/lib/python3.12/site-packages/chomper/core.py", line 210, in _start_emulate self.crash("Unknown reason", exc=e) File "/Users/new/Documents/pythonProject/iosRe/.venv/lib/python3.12/site-packages/chomper/core.py", line 355, in crash raise EmulatorCrashedException( chomper.exceptions.EmulatorCrashedException: Unknown reason at libcorecrypto.dylib!0x1c426a4d8 nanobind: leaked 22 instances!

sledgeh4w commented 3 days ago

chomper 主要用来模拟执行加解密相关的程序,并没有支持所有的 OC 类,尤其是像这种 UI 相关的类。