aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFilipp Lepalaan <filipp@mac.com>2016-10-07 12:24:33 +0300
committerFilipp Lepalaan <filipp@mac.com>2016-10-07 12:24:33 +0300
commitafef02fcb6f5a9ee01f84e54385e37884ac67dfa (patch)
tree7bc7ad9d6c006b8e2f424acb697c6093634b68f1
parent54fe7d25ba0f434987d92884e92c7825f9189abd (diff)
downloadmaucl-afef02fcb6f5a9ee01f84e54385e37884ac67dfa.tar.gz
maucl-afef02fcb6f5a9ee01f84e54385e37884ac67dfa.tar.bz2
maucl-afef02fcb6f5a9ee01f84e54385e37884ac67dfa.zip
Fixed checking MSau
-rw-r--r--README.md4
-rwxr-xr-xmowgli.py29
2 files changed, 22 insertions, 11 deletions
diff --git a/README.md b/README.md
index bd48d07..4df377b 100644
--- a/README.md
+++ b/README.md
@@ -18,9 +18,9 @@ To update all installed Office applications, just issue:
```sudo mowgli.py -ia```
-You can also supply an optional path to the MAU pref file:
+You can also supply an optional path to the home folder:
-```sudo mowgli.py -ia /Users/shared/Library/Preferences/com.microsoft.autoupdate2.plist```
+```sudo mowgli.py -ia /Users/shared```
Special thanks to [Charles](https://www.charlesproxy.com) - the excellent web debugging proxy for making the reverse-engineering possible!
diff --git a/mowgli.py b/mowgli.py
index b1b2fe6..5cd4e91 100755
--- a/mowgli.py
+++ b/mowgli.py
@@ -17,7 +17,6 @@ NAMES = {
'PPT315': 'PowerPoint',
'MSWD15': 'Word',
'MSau03': 'AutoUpdate',
- 'Merp2': 'Error Reporting',
'SLVT': 'Silverlight',
}
@@ -35,12 +34,16 @@ def get_plist(path):
return plistlib.readPlistFromString(plist)
-def check(pref='~/Library/Preferences/com.microsoft.autoupdate2.plist'):
+def check(home=None, pref='Library/Preferences/com.microsoft.autoupdate2.plist'):
"""Collect info about available updates.
"""
results = []
+ if home is None:
+ home = os.getenv('HOME')
+ pref = os.path.join(home, pref)
+
try:
plist = get_plist(os.path.expanduser(pref))
except Exception as e:
@@ -52,6 +55,10 @@ def check(pref='~/Library/Preferences/com.microsoft.autoupdate2.plist'):
path, info = a
app_id = info.get('Application ID')
+ # Skip Microsoft Error Reporting
+ if app_id == 'Merp2':
+ continue
+
try:
app_info = get_plist(os.path.join(path, 'Contents/Info.plist'))
except Exception as e:
@@ -63,13 +70,17 @@ def check(pref='~/Library/Preferences/com.microsoft.autoupdate2.plist'):
# Lync (UCCP14) is special
filename = '0409%s.xml' if app_id == 'UCCP14' else '0409%s-chk.xml'
- conn = httplib.HTTPSConnection('officecdn.microsoft.com')
- conn.request("GET", BASEURL + filename % app_id)
- data = conn.getresponse().read()
+ try:
+ conn = httplib.HTTPSConnection('officecdn.microsoft.com')
+ conn.request("GET", BASEURL + filename % app_id)
+ data = conn.getresponse().read()
+ except Exception as e:
+ raise Exception('Failed to check for updates: %s' % e)
try:
p = plistlib.readPlistFromString(data)
+
if app_id == 'UCCP14': # Lync being special again
p = p[0]
result['location'] = p.get('Location')
@@ -88,7 +99,7 @@ def check(pref='~/Library/Preferences/com.microsoft.autoupdate2.plist'):
# Fetch the update details
updates = plistlib.readPlistFromString(data)
for i in updates:
- if i.get('Baseline Version') == result['installed']:
+ if i.get('Baseline Version') == result['installed'] or app_id == 'MSau03':
result['location'] = i.get('Location')
result['size'] = i.get('FullUpdaterSize')
results.append(result)
@@ -124,10 +135,10 @@ def install(pkg):
if __name__ == '__main__':
if len(sys.argv) < 2:
- print("usage: {0} [-l | -i [pref]".format(os.path.basename(sys.argv[0])))
+ print("usage: {0} [-l | -i [home]".format(os.path.basename(sys.argv[0])))
sys.exit(1)
- print("* Checking for updates...")
+ print("* Finding available software")
if len(sys.argv) > 2:
if not os.path.exists(sys.argv[2]):
@@ -140,7 +151,7 @@ if __name__ == '__main__':
if sys.argv[1] == '-l':
for u in updates:
- print("{id}\t{name}\t{installed}\t{available}\t{size}".format(**u))
+ print(" * {id}\n {name} {installed} - {available} [{type}]".format(**u))
if sys.argv[1] == '-ia':
for u in updates: