From 86e45cc186b6cc81d67c2d306bcc12c8fc46aae5 Mon Sep 17 00:00:00 2001 From: zx Date: Tue, 26 Nov 2024 22:21:13 -0500 Subject: [PATCH] feat(cgen): plist and entitlement merging --- README.md | 1 + cgen/__main__.py | 20 +++++++++++++++++++- cyan/tbhutils.py | 6 ++++++ nogamemode.cyan | Bin 0 -> 414 bytes 4 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 nogamemode.cyan diff --git a/README.md b/README.md index 5ff8ad0..d4f0f2d 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ you can open an issue to request a feature :D !! also see my [recommended flags] - remove watch app - change the app icon - fakesign the output ipa/tipa/app +- merge a plist into the app's existing Info.plist - add custom entitlements to the main executable - thin all binaries to arm64, it can LARGELY reduce app size sometimes! - remove all app extensions (or just encrypted ones!) diff --git a/cgen/__main__.py b/cgen/__main__.py index fe07f51..96a80f0 100644 --- a/cgen/__main__.py +++ b/cgen/__main__.py @@ -42,6 +42,14 @@ def main() -> None: "-k", metavar="icon", help="modify the app's icon" ) + parser.add_argument( + "-l", metavar="plist", + help="a plist to merge with the app's Info.plist" + ) + parser.add_argument( + "-x", metavar="entitlements", + help="add or modify entitlements to the main binary" + ) parser.add_argument( "-u", "--remove-supported-devices", action="store_true", @@ -83,6 +91,10 @@ def generate_cyan(parser: argparse.ArgumentParser) -> None: parser.error(f"invalid minimum OS version: {args.m}") if args.k is not None and not os.path.isfile(args.k): parser.error(f"{args.k} does not exist") + if args.l is not None and not os.path.isfile(args.l): + parser.error(f"{args.l} does not exist") + if args.x is not None and not os.path.isfile(args.x): + parser.error(f"{args.x} does not exist") if args.f is not None: fake = [f for f in args.f if not os.path.exists(f)] @@ -107,7 +119,7 @@ def generate_cyan(parser: argparse.ArgumentParser) -> None: real_args = {k: v for k, v in dict(vars(args)).items() if v} del real_args["output"] - for key in "fk": # these need files + for key in "fkxl": # these need files if key in real_args: real_args[key] = True @@ -136,6 +148,12 @@ def generate_cyan(parser: argparse.ArgumentParser) -> None: if args.k is not None: zf.write(args.k, "icon.idk") + if args.l: + zf.write(args.l, "merge.plist") + + if args.x: + zf.write(args.x, "new.entitlements") + if __name__ == "__main__": main() diff --git a/cyan/tbhutils.py b/cyan/tbhutils.py index 9d62630..90524ba 100644 --- a/cyan/tbhutils.py +++ b/cyan/tbhutils.py @@ -253,6 +253,12 @@ def parse_cyan(args: dict[str, Any], tmpdir: str) -> None: if "k" in config: args["k"] = zf.extract("icon.idk", DOT_PATH) del config["k"] + if "l" in config: + args["l"] = zf.extract("merge.plist", DOT_PATH) + del config["l"] + if "x" in config: + args["x"] = zf.extract("new.entitlements", DOT_PATH) + del config["x"] for k, v in config.items(): args[k] = v diff --git a/nogamemode.cyan b/nogamemode.cyan new file mode 100644 index 0000000000000000000000000000000000000000..67298f534911d0bfc84666480fb43ffda464416b GIT binary patch literal 414 zcmWIWW@Zs#U|`??Vnv4Ip5Nnmfh=w)PR`Fu%S_kHD$dVa9d;^kQ;>$HmhW0th5)!O zj}29kth=vqZwKml1J#wAT9lruSCErgToT%Mkgv%=z~z0-(OcGQ?)7L2u&Su6P&sf= zd0}X$gLIVZzk5pR-z{c-Ph0u_WmLsyN7F^+Cyzx6Kd9A>xO_i0NX)(3yXO3&)gOdJ zuIn(}H1l!}le?tCkfi)>X^v%5M9YMwo^cI@3U294PZn;yquBTOMM&}Km9FOEqG`<& zYAyt4rEFuASte;{-2L~x?Bq?$uFYe8_F}SsoXit_&7%uKV@m(1NG!K_?)^AyYuDn1 z1qU_$Et!{E%NXFz$RxsyJ6wPs1%n1g5QP*<$QrQ)4MZCQ!;(fbAQLH|0=!w-K$1*A LSOlcSz$OC#r=fxQ literal 0 HcmV?d00001