iOS App 证书监控

最近App Store停止个人申请个人开发者证书,导致公司超级签名无法使用,被迫找第三方证书签名。第三方证书签名不稳定,存在证书被查封的风险,为了实时监控iOS是否可以继续使用,特意写了一个脚本来监控证书状态,失效收发送钉钉报警。

监控使用真机监控,需要准备的必要条件:

  • 1、苹果手机

  • 2、苹果系统电脑

  • 3、xcode(可以在App Store直接下载安装)

  • 4、python3 可以在官网直接下载安装

  • 5、ios-deploy (用命令向真机安装 app)

    我们用npm来安装ios-deploy,如果Mac上没有,先安装node:

brew install node
npm install -g ios-deploy

下面直接附上脚本

# -*- coding: utf-8 -*-

import os
from dingtalkchatbot.chatbot import DingtalkChatbot
import time

webhook = 'https://oapi.dingtalk.com/robot/send?access_token=你的token'

xiaoding = DingtalkChatbot(webhook)



def ios():
    type_list = []
    lists = os.listdir('/Users/bitz/Desktop/IOS-app/')
    list_file = lists[1:]
    list_file.sort(key=lambda fn: os.path.getmtime('/Users/xxx/Desktop/IOS-app/' + '/' + fn))  # 按时间排序
    file_new = os.path.join('/Users/xxx/Desktop/IOS-app/', list_file[-1])  # 获取最新的文件保存到file_new
    file_time = os.path.getmtime(file_new)
    now = time.strftime("%Y-%m-%d-%H:%M:%S", time.localtime())
    print(now)
    # 检测手机连接
    jc = 'ios-deploy -c --no-wifi'
    values = os.system(jc)
    print(int(values >> 8))
    if int(values >> 8) == 0:
        shell = 'ios-deploy --uninstall --justlaunch --bundle {}'.format(file_new)
        val = os.system(shell)
        print('状态:' + str(val >> 8))
        if str(val >> 8) != '1':
            type_list.append(1)
        else:
            type_list.append(0)

    else:
        print('手机与电脑连接出现问题!!!')

    xiaoding.send_text(msg="IOS签名包可能掉签了!!!" + str(val >> 8))
    print(now + 'IOS签名包可能掉签了!!!')

while True:
    ios()
    time.sleep(600)

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • 引言 关于开发证书配置(Certificates & Identifiers & Provisioning Pro...
    Damen_9527阅读 9,430评论 0 4
  • 1.webkit-text-size-adjust iPhone 和 Android 的浏览器纵向 (Portra...
    lmem阅读 588评论 0 0
  • 有一个看不到的地方,它广袤无边,并且每个人都到过这儿。 在这个地方:我们从同一个起点出发,用不同的方法,走着不同的...
    微子上帝阅读 155评论 0 0