在 iOSGuard 侧产出可集成产物与接入文档,不修改 readoor 代码。 - defender/: anti_hook/anti_frida/anti_debug/anti_jailbreak 探针 + syscall 直发、 policy 分级层、poison 数据依赖毒化、dispatch/resolve/call_bridge 等子模块 - poison: 三副本冗余、无分支掩码;健康恒等、毒化破坏 key(替代 if-exit 处置) - policy: STRONG/MEDIUM/WEAK 分级,守误报底线,仅 DETECTED 参与、组合命中才毒化 - anti_jailbreak: IGSyscall 直发 svc 检测越狱文件(400)/沙盒逃逸(401),绕 libc hook - tools/build_defender_lib.sh: 一键交叉编译打包 libIGDefender.a(arm64) + umbrella 头 - docs/18_READOOR_DEFENDER_INTEGRATION.md: 精确到文件/bridging/替换点/代码片段 - docs/05-17 + evidence + tests + macho_guard/static_sdk_redirect 工具链 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
35 lines
1.5 KiB
Objective-C
35 lines
1.5 KiB
Objective-C
/* 独立诊断进程:只在自身进程测试,不连接业务、不改系统代码。 */
|
|
#import <Foundation/Foundation.h>
|
|
#include "IGDefender.h"
|
|
#include <stdio.h>
|
|
|
|
int ig_dispatch_fixture_main(int argc, char **argv);
|
|
static int findings, unavailable;
|
|
static int collect(const IGFinding *f, void *ctx) {
|
|
(void)ctx;
|
|
if (f->status==IG_DETECTED) findings++;
|
|
if (f->status==IG_UNAVAILABLE) unavailable++;
|
|
NSLog(@"IG_DEVICE_FINDING status=%d reason=%d subject=%s evidence=%s",
|
|
f->status,f->reason,f->subject,f->evidence);
|
|
return 0;
|
|
}
|
|
|
|
int main(int argc,char **argv) {
|
|
(void)argc;(void)argv;
|
|
@autoreleasepool {
|
|
NSLog(@"IG_DEVICE_MAIN");
|
|
const char *modes[]={"semantics","short-write","eintr","threads","reentry","resolver","prologue","tamper"};
|
|
int hits=ig_defender_scan(NSBundle.mainBundle.bundlePath.UTF8String,0,collect,NULL);
|
|
NSLog(@"IG_DEVICE_BASELINE detected=%d unavailable=%d hits=%d",findings,unavailable,hits);
|
|
for (unsigned i=0;i<sizeof(modes)/sizeof(modes[0]);i++) {
|
|
char *args[]={"dispatch-device",(char *)modes[i],NULL};
|
|
int rc=ig_dispatch_fixture_main(2,args);
|
|
NSLog(@"IG_DEVICE_CASE %s %s",modes[i],rc==0 ? "PASS" : "FAIL");
|
|
if (rc) return rc;
|
|
}
|
|
NSLog(@"IG_DEVICE_SUITE PASS cases=8 baseline_detected=%d baseline_unavailable=%d",findings,unavailable);
|
|
/* 诊断进程退出便于 console 收集退出码;不编入业务 App。 */
|
|
return findings || unavailable ? 3 : 0;
|
|
}
|
|
}
|