Skip to content

Instantly share code, notes, and snippets.

@fschulze
Created September 20, 2017 17:57
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 fschulze/1f81c70fa5c0c44750a136f693210666 to your computer and use it in GitHub Desktop.
Save fschulze/1f81c70fa5c0c44750a136f693210666 to your computer and use it in GitHub Desktop.
# run in a temporary folder to list 32 bit only iOS apps from your iTunes Library
from glob import glob
import os
import plistlib
import subprocess
import textwrap
import zipfile
ipas = glob(os.path.expanduser('~/Music/iTunes/Mobile Applications/*.ipa'))
for ipa in ipas:
z = zipfile.ZipFile(ipa)
appfiles = list(x for x in z.namelist() if '.app/' in x)
apppath = appfiles[0]
appname = os.path.splitext(apppath.split('/')[1])[0]
appfn = apppath + appname
if appfn not in appfiles:
appfn = apppath + appname.lower()
z.extract(appfn)
out = subprocess.check_output(['file', appfn])
os.remove(appfn)
out = textwrap.indent(out.decode('utf-8'), ' ')
os.rmdir(apppath)
if '64-bit' in out:
continue
plistfn = 'iTunesMetadata.plist'
z.extract(plistfn)
meta = plistlib.loads(open(plistfn, 'rb').read())
os.remove(plistfn)
devices = set(int(x) for x in meta.get('softwareSupportedDeviceIds', []))
if 9 in devices:
continue
plistfn = apppath + 'Info.plist'
z.extract(plistfn)
info = plistlib.loads(open(plistfn, 'rb').read())
os.remove(plistfn)
os.rmdir(apppath)
print(meta['itemName'])
print(' ', devices)
print(' ', ipa)
print(out)
os.rmdir('Payload')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment