背景:公司的競品分析業(yè)務(wù),需要下載appstore競品app來分析
目前方案: wda下載app除呵,非完美越獄后破殼再菊、dump頭文件。
弊端:流程繁瑣颜曾,穩(wěn)定性差(目前成功率在80%以上)纠拔,且無法覆蓋歷史版本。
越獄市場有叫 appstore++的插件泛豪,可以實(shí)現(xiàn)下載appstore 任意應(yīng)用任意歷史包稠诲。這是我們想要的效果,但是appstore++都是基于頁面操作來完成诡曙,無法實(shí)現(xiàn)自動化臀叙。
趁著下午時(shí)間空閑,看看apsptore++實(shí)現(xiàn)价卤,防止自己忘掉劝萤,留下此文章,以便自己找回或者方便后人繼續(xù)研究荠雕。
歷史版本
分析了appstore++中的 appstoreplusSB.dylib
動態(tài)庫稳其,發(fā)現(xiàn)他的歷史版本其實(shí)是通過接口傳入bundleId拉取到的。
例如: https://mixrank.com/appstore/apps/529479190/versions
下載歷史版本
appstore++ 執(zhí)行下載的方法
-[ASPPSpringBoardUtils completeDowngradeWithAdamId:externalId:](void * self, void * _cmd, void * arg2, void * arg3)
調(diào)用 ios下載的代碼
[[SKUIItemStateCenter defaultCenter] _performPurchases:NSArray<SKUIItem *>) *item hasBundlePurchase:(BOOL) purchased withClientContext:(SKUIClientContext *)context completeBlock:nil]
解讀:
參數(shù)1:SKUIItem
下載項(xiàng)炸卑,可同時(shí)下載多個(gè)既鞠。
r10 = [objc_getClass("SKUIItem") alloc];
[r10 setItemIdentifier:r2]; // r2 = SKUIItemOffer
[r10 setValue:r8 forKey:@"_itemOffer"]; // r8 = AdamId
[r10 setValue:@"iosSoftware" forKey:@"_itemKindString"];
[r10 setValue:stack[2028] forKey:@"_versionIdentifier"]; // stack[2028] = externalId
參數(shù)2:SKUIClientContext
單利,直接 調(diào)用 [SKUIClientContext defaultContext] 為空盖文,應(yīng)該是打開appstore且有下載應(yīng)用時(shí)才會有值嘱蛋。
后續(xù)自動化思路
由于必須獲取到 上下文,所以可以寫一個(gè) demaeon 服務(wù),實(shí)現(xiàn) 喚起appstore洒敏,接收下載指定版本指令龄恋,砸殼,回傳Agent凶伙。
ps:由于時(shí)間問題郭毕, 自己到目前還未實(shí)現(xiàn),也許此路不通函荣。如果有人基于此思路實(shí)現(xiàn)显押,希望可以在下面評論方案可行,方便后人傻挂。謝謝