Skip to content

Instantly share code, notes, and snippets.

@LewisLebentz
Last active December 12, 2021 05:52
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LewisLebentz/b819019a2c4dbde7dbdbecc8f78f39b3 to your computer and use it in GitHub Desktop.
Save LewisLebentz/b819019a2c4dbde7dbdbecc8f78f39b3 to your computer and use it in GitHub Desktop.
Python script to get the latest version number of Chrome from Google and compare it to the version of Chrome installed on the local Mac. Then updates an Extension Attribute in Jamf Pro with either 'Latest' or 'Old'.
#!/usr/bin/python
import json
import urllib2
import os.path
import plistlib
url = 'http://omahaproxy.appspot.com/all.json'
resp = urllib2.urlopen(url)
data = json.loads(resp.read())
for each in data:
if each.get("os") == "mac":
versions = each.get("versions")
for version in versions:
if version.get("channel") == "stable":
latest = (version.get("current_version"))
print latest
print os.path.exists("/Applications/Google Chrome.app")
plistloc = "/Applications/Google Chrome.app/Contents/Info.plist"
pl = plistlib.readPlist(plistloc)
pver = pl["CFBundleShortVersionString"]
print pver
if latest == pver:
print "<result>Latest</result>"
else:
print "<result>Old</result>"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment