Created
March 4, 2020 21:06
-
-
Save unstablereality/63df70d189f19c620694a7dc8b008463 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
#!/usr/bin/python | |
import subprocess | |
import plistlib | |
import argparse | |
def get_bundle_id(plist): | |
return plist['Name'].replace('iOS Team Provisioning Profile: ', '') | |
def get_uuid(plist): | |
return plist['UUID'] | |
FUNCTIONS = {'bundle_id': get_bundle_id, | |
'uuid': get_uuid } | |
parser = argparse.ArgumentParser(description="Get information from an Apple Provisioning Profile Plist") | |
parser.add_argument('file', type=str) | |
parser.add_argument('command', choices=FUNCTIONS.keys()) | |
args = parser.parse_args() | |
xmlPath = '/Users/cbtadmin/Library/MobileDevice/Provisioning Profiles/%s.mobileprovision' % args.file | |
plistXml = subprocess.check_output(['security', 'cms', '-D', '-i', xmlPath]) | |
plistObj = plistlib.readPlistFromString(plistXml) | |
func = FUNCTIONS[args.command] | |
print(func(plistObj)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment