Skip to content

Instantly share code, notes, and snippets.

@arubdesu
Created November 25, 2015 22:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arubdesu/65102ce4b05b06eaffd0 to your computer and use it in GitHub Desktop.
Save arubdesu/65102ce4b05b06eaffd0 to your computer and use it in GitHub Desktop.
haven't worked in sig validation, but runs
#!/usr/bin/python
"""
Checks the MountainLion-Era version of the xprotect plist for the current
version number, compares it against version on disk.
"""
import urllib2
import sys
sys.path.append("/usr/local/munki/munkilib")
import FoundationPlist
def fetch_xversion():
"""fetches outdated URL with current version of xprotect in it"""
try:
response = urllib2.urlopen('http://configuration.apple.com/configurations/macosx/xprotect/3/clientConfiguration.plist')
except urllib2.URLError as err:
raise err
whole = response.read()
halves = whole.split('----- END SIGNATURE -----')
plistobj = FoundationPlist.readPlistFromString(halves[1])
return int(plistobj['meta']['Version'])
def look_local():
"""checks local xprotect version"""
local_xprotect = FoundationPlist.readPlist('/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/XProtect.meta.plist')
return int(local_xprotect['Version'])
def main():
"""gimme some main"""
fetched = fetch_xversion()
localx = look_local()
print fetched, localx
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment