摘要:iOS自动化代码安全审计:程序自动化执行
这个问题一直很困惑我,iOS 6.x以前是有解决方案的,可以参考Cydia中的Open。但是到iOS6上会导致SpringBoard crash。因此就需要自己实现。网上传闻比较多的:
[[UIApplication sharedApplication] launchApplicationWithIdentifier:identifier suspended:NO];
我测试之下并不好用,怀疑要么是权限问题或者是代码已经被Apple干掉了接口,而且这个也不太方便通过命令行控制实现,因此需要找一个更好的方法。
下面是具体实现:
NSString *bundleId = [[NSString alloc] initWithFormat:@"%s",argv[1]];
void* sbServices = dlopen("/System/Library/PrivateFrameworks/SpringBoardServices.framework/SpringBoardServices", RTLD_LAZY);
int (*SBSLaunchApplicationWithIdentifier)(CFStringRef identifier, Boolean suspended) = dlsym(sbServices, "SBSLaunchApplicationWithIdentifier");
int result = SBSLaunchApplicationWithIdentifier((CFStringRef)bundleId, false);
dlclose(sbServices);
return result;
------------------------------
文章的授權使用CC BY-ND2.5協議。凡是標示“轉載”的文章,均來源於網絡並儘可能標註作者。如果有侵犯您的權益,請及時聯繫刪除或者署名、授權。
Gtalk/Email: cmd4shell [at] gmail.com