Created
September 20, 2017 17:57
-
-
Save fschulze/1f81c70fa5c0c44750a136f693210666 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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