gatekeeper_date.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:unearth 作者: chilcote 项目源码 文件源码
def fact():
    '''Returns the modification date of the gatekeeper package'''
    result = 'None'

    try:
        gkpkgs = subprocess.check_output(['/usr/sbin/pkgutil',
                                        '--pkgs=.*Gatekeeper.*'])
        dates = []
        for pkgid in gkpkgs.splitlines():
            pkginfo_plist = subprocess.check_output(['/usr/sbin/pkgutil',
                                                     '--pkg-info-plist', pkgid])
            pkginfo       = plistlib.readPlistFromString(pkginfo_plist)
            dates.append(pkginfo['install-time'])
        result = time.strftime('%Y-%m-%dT%H:%M:%S', time.localtime(max(dates)))
    except (OSError, IOError, subprocess.CalledProcessError):
        pass

    return {factoid: result}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号