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}
评论列表
文章目录