Created
August 7, 2023 01:50
-
-
Save rinsuki/2026b8bcf462367ba557cbc01531646f 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
import glob | |
import plistlib | |
FAKE_VERSION = b"22G74" | |
for file in glob.iglob("**/Info.plist", recursive=True): | |
if ".storyboardc/" in file: | |
continue | |
print(file) | |
with open(file, "rb") as fp: | |
f = fp.read() | |
if not f.startswith(b"bplist00"): | |
print("not bplist, skipping...") | |
continue | |
obj = plistlib.loads(f, fmt=plistlib.PlistFormat.FMT_BINARY) | |
print(obj) | |
if "BuildMachineOSBuild" in obj: | |
obj["BuildMachineOSBuild"] = FAKE_VERSION | |
else: | |
raise Exception("not found 1") | |
with open(file, "wb") as fp: | |
plistlib.dump(obj, fp, fmt=plistlib.PlistFormat.FMT_BINARY) | |
for file in glob.iglob("**/*.intentdefinition", recursive=True): | |
print(file) | |
with open(file, "rb") as fp: | |
f = fp.read() | |
if not f.startswith(b"<?xml"): | |
raise Exception("not xml plist") | |
obj = plistlib.loads(f) | |
if "INIntentDefinitionSystemVersion" in obj: | |
obj["INIntentDefinitionSystemVersion"] = FAKE_VERSION | |
else: | |
raise Exception("not found 2") | |
with open(file, "wb") as fp: | |
plistlib.dump(obj, fp, fmt=plistlib.PlistFormat.FMT_XML) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment