-
-
Save pentagramz/8ece6d0842523e6f9d8d971648edb93b to your computer and use it in GitHub Desktop.
Revisions
-
ronsims2 revised this gist
Mar 20, 2019 . No changes.There are no files selected for viewing
-
ronsims2 revised this gist
Mar 20, 2019 . 1 changed file with 10 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -37,10 +37,14 @@ def base64ify(fn): soup = bs4.BeautifulSoup(provxml, 'html.parser') certs = None exp_date = None for k in soup('key'): if k.string == 'DeveloperCertificates': certs = [x.string for x in k.findNext('array').findAll('data')] if k.string == 'ExpirationDate': exp_date = k.findNext('date').string # Decode cert and compare to specified cert @@ -51,4 +55,10 @@ def base64ify(fn): print('Certificate (' + str(i + 1) + ') beginning: ' + cer[0: 9] + '... matches the specified certificate: ' + cert) if exp_date is not None: print('This provisioning profile expires on: ' + exp_date) else: print('the provisioning profiles expiration date could not be parsed.') print('The cert checker has finished.') -
ronsims2 revised this gist
Mar 19, 2019 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -2,9 +2,9 @@ Example : python ipa_cert_checker.py /Users/janedoe/Documents/Foobar.ipa /Users/janedoe/Documents/barfoo.cer If any matching certs are found, the script will print something similar to: Certificate (1) beginning: XCVBNM... matches the specified certificate: /Users/janedoe/Documents/barfoo.cer -
ronsims2 revised this gist
Mar 19, 2019 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,7 @@ # Verify an IPA's Signing Certificate Example : python ipa_cert_checker.py /Users/janedoe/Dcouments/Foobar.ipa /Users/janedoe/Dcouments/barfoo.cer -
ronsims2 revised this gist
Mar 19, 2019 . No changes.There are no files selected for viewing
-
ronsims2 created this gist
Mar 19, 2019 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,9 @@ # Verify an IPA's Signing Certificate Example : python ipa_cert_checker.py /Users/janedoe/Dcouments/Foobar.ipa /Users/janedoe/Dcouments/barfoo.cer If any matching certs are found, the script will print something similar to: Certificate (1) beginning: XCVBNM... matches the specified certificate: /Users/janedoe/Dcouments/barfoo.cer This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,54 @@ import subprocess import sys import zipfile import bs4 import base64 if len(sys.argv) != 3: print('Invalid number of arguments.') exit(1) ipa = sys.argv[1] app_name = ipa.split('/')[-1].split('.')[0] cert = sys.argv[2] workspace = '/'.join(sys.argv[1].split('/')[0:-1]) provfile = workspace + '/Payload/' + app_name + '.app/embedded.mobileprovision' # Unzip the IPA file with zipfile.ZipFile(ipa, 'r') as ipa_file: ipa_file.extractall(workspace) get_prov = subprocess.Popen(['security', 'cms', '-Di', provfile], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) provxml = ''.join(map(lambda x: str(x, 'utf-8'), get_prov.stdout.readlines())) def base64ify(fn): with open(fn, 'rb') as f: return str(base64.b64encode(f.read()), 'utf-8') # Parse doc to get cert base64 string soup = bs4.BeautifulSoup(provxml, 'html.parser') certs = None for k in soup('key'): if k.string == 'DeveloperCertificates': certs = [x.string for x in k.findNext('array').findAll('data')] # Decode cert and compare to specified cert refcert = base64ify(cert) for i, cer in enumerate(certs): if cer == refcert: print('Certificate (' + str(i + 1) + ') beginning: ' + cer[0: 9] + '... matches the specified certificate: ' + cert) print('The cert checker has finished.') This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,4 @@ beautifulsoup4==4.7.1 certifi==2019.3.9 chardet==3.0.4 soupsieve==1.8