com.apple.storeservices

StoreServices.framework的应用

Posted by kunnan on May 14, 2018

前言

  • 清理
    /var/mobile/Library/Caches/com.apple.storeservices
    /var/mobile/Library/Caches/com.apple.storeservices/SSAppImageDatabaseCacheEntry
    
  • 实现自动登录AppleID,要结合 [[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.tencent.xin" suspended:0]; 一起

SSAccountStore

  • 注销- (void)signOutAllAccounts;
    [SSAccountStore performSelectorOnMainThread:@selector(signOutAllAccounts) withObject:nil waitUntilDone:NO];
    
  • 获取对象
    id SSAccountStore = [objc_getClass("SSAccountStore") defaultStore];
    id account = [SSAccountStore activeAccount];
    

SSClientAccountStore : SSAccountStore

使用MSHookMessageEx 或者%hook 进行处理updateAccountsWithMessage

  • - (void)updateAccountsWithMessage:(id)arg1 completionBlock:(id /* block */)arg2;
         id SSAccountStore = [objc_getClass("SSAccountStore") defaultStore];
    
  • 获取当前活跃的账户
    [SSAccountStore activeAccount] accountName] 
    

自动登录APPleID

思路一: 在preference中进行登录

  • 思路:先利用sb 打开preference,再使用tweak进行代码实现

  • 打开Preferences
    //方式一
    /Applications/Preferences.app/Preferences
             [Tools launchApp:@"com.apple.Preferences"];
    [[UIApplication sharedApplication] launchApplicationWithIdentifier:@"com.tencent.xin" suspended:0];//方式二
    
  • cy# [[[UIWindow keyWindow] rootViewController] _printHierarchy].toString()
    `<PSSplitViewController 0x150f3800>, state: appeared, view: <UILayoutContainerView 0x146a79f0>
     | <UINavigationController 0x146b3fc0>, state: appeared, view: <UILayoutContainerView 0x146b5940>
     |    | <PrefsListController 0x148fce00>, state: disappeared, view: <UIView 0x146aa030> not in the window
     |    | <PrefsRootController 0x150e6e00>, state: appeared, view: <UILayoutContainerView 0x1451aaf0>
     |    |    | <StoreSettingsController 0x148f4a00>, state: appeared, view: <UIView 0x1461f440>`
    

####### 核心关键的class

  • 通过 PSEditableTableCell 设置账号信息
     UITableViewCell *cell =  [table cellForRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
     [[cell textField] setText:@"@qq.com"];
    
  • 注意细节
    #debian/postinst  
    function kill_all_process() {
      echo "killall -9 WeChat"
       killall -9 WeChat
       echo "killall -9 Preferences"
      killall -9 Preferences 
      #  killall -9 backboardd
      echo "killall SpringBoard"
    # 因此新增了自动解锁的功能,以后这个功能可以从lua 脚本移除
      killall -9 SpringBoard # 通常放在最后
    }
    

思路二: 下载的时候,在app store中拦截弹框,判断弹框标题需要登录进行处理

  • 利用hook 系统的弹框( 可以是创建的方法CFUserNotificationCreate ),去掉烦人的弹框
    //未安装 SIM 卡
    本质上就是修改返回值: CFUserNotificationRef ,其实就是一个字典
    

CFUserNotification

CFUserNotificationCreate

  • CFUserNotificationCreate 使用的简单例子
    CFDictionaryRef dictionary ,存储这个标题和内容的字典对象; 可以使用kCFUserNotification 进行操作,也可以采用桥接的方式
    NSDictionary* dict = (NSDictionary*) dictionary;
    

CFUserNotificationCreate 在theos 中使用的例子

  • framework
    devzkndeMacBook-Pro:UIDeviceCrasher devzkn$ /Users/devzkn/code/iosre/UIDeviceCrasher/framework/include/CoreFoundation/CFUserNotification.h 
    
  • /opt/theos/include 应当放入一些CoreFoundation的头文件
    sudo  cp -a framework/include/CoreFoundation /opt/theos/include
    # /Users/devzkn/code/iosre/CoreFoundation  可以考虑创建一个软链接
    

典型例子

RocketBootstrap

  • Makefile
    TOOL_NAME = rocketd
    rocketd_FRAMEWORKS = CoreFoundation
    stage::
      mkdir -p "$(THEOS_STAGING_DIR)/usr/include"
      cp -a rocketbootstrap.h rocketbootstrap_dynamic.h "$(THEOS_STAGING_DIR)/usr/include"
      plutil -convert binary1 "$(THEOS_STAGING_DIR)/Library/MobileSubstrate/DynamicLibraries/RocketBootstrap.plist"
    
  • 这个代码可以和之前的文章custom-input-sources结合起来看

See Also

/Users/devzkn/bin/knpost com.apple.storeservices StoreServices.framework的应用 -t iosre
#原来""的参数,需要自己加上""

转载请注明: > com.apple.storeservices