From a239070a89848f091c5356f54d8feffc81939a7c Mon Sep 17 00:00:00 2001 From: Ali <> Date: Wed, 10 Feb 2021 10:41:37 +0400 Subject: [PATCH] Adjust ipadiff to the latest App Store changes and cleanup --- tools/ipadiff.py | 40 ++++++++++++++++++++++++---------------- tools/main.cpp | 3 +++ 2 files changed, 27 insertions(+), 16 deletions(-) diff --git a/tools/ipadiff.py b/tools/ipadiff.py index 885ba3047c..3a335610ed 100644 --- a/tools/ipadiff.py +++ b/tools/ipadiff.py @@ -24,12 +24,16 @@ def remove_codesign_dirs(dirs): for dir in dirs: if dir == 'SC_Info': continue - if re.match('Watch/.*\\.appex/SC_Info', dir): + if re.match('^Watch/.*\\.appex/SC_Info', dir): continue - if re.match('PlugIns/.*\\.appex/SC_Info', dir): + if re.match('^PlugIns/.*\\.appex/SC_Info', dir): continue - if re.match('Frameworks/.*\\.framework/SC_Info', dir): + if re.match('^Frameworks/.*\\.framework/SC_Info', dir): continue + if re.match('^Watch(/.*)?', dir): + continue + if re.match('^com\\.apple\\.WatchPlaceholder(/.*)?', dir): + continue result.add(dir) return result @@ -39,18 +43,20 @@ def remove_codesign_files(files): for f in files: if f == 'embedded.mobileprovision': continue - if re.match('.*/.*\\.appex/embedded.mobileprovision', f): + if re.match('^.*/.*\\.appex/embedded.mobileprovision', f): continue if f == '_CodeSignature/CodeResources': continue if f == 'CrackerXI': continue - if re.match('Watch/.*\\.app/embedded.mobileprovision', f): + if re.match('^Watch/.*\\.app/embedded.mobileprovision', f): continue - if re.match('PlugIns/.*\\.appex/_CodeSignature/CodeResources', f): + if re.match('^PlugIns/.*\\.appex/_CodeSignature/CodeResources', f): continue - if re.match('Frameworks/.*\\.framework/_CodeSignature/CodeResources', f): + if re.match('^Frameworks/.*\\.framework/_CodeSignature/CodeResources', f): continue + if re.match('^Frameworks/libswift*', f): + continue result.add(f) return result @@ -59,8 +65,10 @@ def remove_watch_files(files): result = set() excluded = set() for f in files: - if re.match('Watch/.*', f): + if re.match('^Watch/.*', f): excluded.add(f) + elif re.match('^com\\.apple\\.WatchPlaceholder/.*', f): + excluded.add(f) else: result.add(f) return (result, excluded) @@ -70,7 +78,7 @@ def remove_plugin_files(files): result = set() excluded = set() for f in files: - if False and re.match('PlugIns/.*', f): + if False and re.match('^PlugIns/.*', f): excluded.add(f) else: result.add(f) @@ -81,7 +89,7 @@ def remove_asset_files(files): result = set() excluded = set() for f in files: - if re.match('.*\\.car', f): + if re.match('^.*\\.car', f): excluded.add(f) else: result.add(f) @@ -92,7 +100,7 @@ def remove_nib_files(files): result = set() excluded = set() for f in files: - if re.match('.*\\.nib', f): + if re.match('^.*\\.nib', f): excluded.add(f) else: result.add(f) @@ -125,7 +133,7 @@ def is_binary(file): def is_xcconfig(file): - if re.match('.*\\.xcconfig', file): + if re.match('^.*\\.xcconfig', file): return True else: return False @@ -161,7 +169,7 @@ def is_plist(file1): def diff_plists(file1, file2): - remove_properties = ['UISupportedDevices', 'DTAppStoreToolsBuild', 'MinimumOSVersion', 'BuildMachineOSBuild', 'CFBundleVersion'] + remove_properties = ['UISupportedDevices', 'DTAppStoreToolsBuild', 'MinimumOSVersion', 'BuildMachineOSBuild', 'CFBundleVersion', 'ITSDRMScheme'] clean1_properties = '' clean2_properties = '' @@ -250,12 +258,12 @@ def ipadiff(self_base_path, ipa1, ipa2): clean_ipa1_files = remove_codesign_files(ipa1_files) clean_ipa2_files = remove_codesign_files(ipa2_files) - diff_dirs(ipa1, clean_ipa1_dirs, ipa2, clean_ipa2_dirs) - diff_files(ipa1, clean_ipa1_files, ipa2, clean_ipa2_files) - clean_ipa1_files, watch_ipa1_files = remove_watch_files(clean_ipa1_files) clean_ipa2_files, watch_ipa2_files = remove_watch_files(clean_ipa2_files) + diff_dirs(ipa1, clean_ipa1_dirs, ipa2, clean_ipa2_dirs) + diff_files(ipa1, clean_ipa1_files, ipa2, clean_ipa2_files) + clean_ipa1_files, plugin_ipa1_files = remove_plugin_files(clean_ipa1_files) clean_ipa2_files, plugin_ipa2_files = remove_plugin_files(clean_ipa2_files) diff --git a/tools/main.cpp b/tools/main.cpp index 540eee9687..90a4b235c5 100644 --- a/tools/main.cpp +++ b/tools/main.cpp @@ -78,6 +78,9 @@ static bool cleanArch(std::vector &archData, bool &isEncrypted) { if (encryptionInfoCommand->cryptid != 0) { isEncrypted = true; } + // The App Store has begun to change offsets in LC_ENCRYPTION_INFO + memset(archData.data() + offset + offsetof(encryption_info_command_64, cryptoff), 0, sizeof(uint32_t)); + memset(archData.data() + offset + offsetof(encryption_info_command_64, cryptsize), 0, sizeof(uint32_t)); } offset += commandSize;