From 3e14bd451fe0dda26e766a6086ceca42e1e74b57 Mon Sep 17 00:00:00 2001 From: zx Date: Mon, 3 Jun 2024 18:20:52 -0400 Subject: [PATCH] feat: specify bundle id --- README.md | 26 ++++++++++++++++++++++++++ appdupe.py | 33 ++++++++++++++++++++++----------- 2 files changed, 48 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 361d1fa..e30a66e 100644 --- a/README.md +++ b/README.md @@ -28,3 +28,29 @@ this is really messy. i made this without caring about quality so there's probab also, there might be some remaining shared app containers due to app extensions. you can use [pyzule](https://github.com/asdfzxcvbn/pyzule) to remove app extensions, change the app display name, and modify the app further. don't change the bundle id though.. not sure if that would break anything due to changing `application-identifier`. you can try if you want and tell me if it works, just open an issue or dm me on telegram or something. + +## updating duped apps +let's think of this example: you need to duplicate discord, so you run this command: + +```shell +$ python appdupe.py -i ~/Discord-v217.0.ipa -o ~/DiscordDupe +[?] ipa file extension not detected, appending manually +[*] using seed: "7c54c5db-d6c3-41f7-a5ab-c21d87e3e4e2" (save this!) +[*] will use bundle id: fyi.zxcvbn.appdupe.700603c620 (save this!) +[*] will use team id: 1429A9E38A +[*] done, remember to remove app extensions (if u wanna) +``` + +everything works fine! but what if you wanted to update the duped discord? starting in v1.1 you can use -s and -b to achieve this. simply remember to save the command's output (like appdupe tells you to) then run: + +```shell +# "700603c620" was the last part of the bundle id given to us last time +$ python appdupe.py -i ~/Discord-v218.0.ipa -o ~/DiscordDupeUpdated -s "7c54c5db-d6c3-41f7-a5ab-c21d87e3e4e2" -b 700603c620 +[?] ipa file extension not detected, appending manually +[*] using seed: "7c54c5db-d6c3-41f7-a5ab-c21d87e3e4e2" (save this!) +[*] will use bundle id: fyi.zxcvbn.appdupe.700603c620 (save this!) +[*] will use team id: 1429A9E38A +[*] done, remember to remove app extensions (if u wanna) +``` + +then you can install the updated ipa normally, and you'll keep all your data. diff --git a/appdupe.py b/appdupe.py index 58eaa95..cced152 100755 --- a/appdupe.py +++ b/appdupe.py @@ -17,23 +17,26 @@ help="duplicated ipa to create") # bundle id will be changed to `fyi.zxcvbn.appdupe.` -# will be always be random, -# only teamid is derived from seed +# will be always be random, only teamid is derived from seed parser.add_argument("-s", metavar="seed", help="a \"seed\" to derive the app id from " - "(any string of your choosing -- will always produce same output)") + "(any string of your choosing)") + +parser.add_argument("-b", metavar="id", help="bundle id to use (see README)") args = parser.parse_args() # thanks pyzule for source +if not args.o.endswith(".ipa"): + print("[?] ipa file extension not detected, appending manually") + args.o += ".ipa" if os.path.exists(args.o): overwrite = (input(f"[<] {args.o} already exists. overwrite? [Y/n] ") .lower().strip()) if overwrite in ("y", "yes", ""): del overwrite else: - print("[>] quitting.") - quit() + quit("[>] quitting.") # no ipa checks this time. maybe use the tool correctly? :D if args.s is None: @@ -42,15 +45,23 @@ # team identifiers are 10 chars, A-Z, and 0-9 HASHED_STR = sha256(args.s.encode()).hexdigest().upper() TEAM_ID = HASHED_STR[-10:] - -# bundle will be random every time, shared teamid will allow -# apps to communicate with each other (e.g. youtube, ytmusic, google docs) -BUNDLE = f"fyi.zxcvbn.appdupe.{uuid4().hex[:10]}" BUNDLE_TI = f"fyi.zxcvbn.appdupe.{TEAM_ID}" -print(f"[*] using seed: \"{args.s}\"") +# bundle will be random every time (unless specified), +# shared teamid will allow apps to communicate with each other +# (e.g. youtube, ytmusic, google docs) +if args.b is None: + BUNDLE = f"fyi.zxcvbn.appdupe.{uuid4().hex[:10]}" +elif len(args.b) != 10: + quit("[!] -b argument has invalid length (see README)") +elif any(c not in "0123456789abcdef" for c in args.b): + quit("[!] -b argument is invalid (see README)") +else: + BUNDLE = f"fyi.zxcvbn.appdupe.{args.b}" + +print(f"[*] using seed: \"{args.s}\" (save this!)") +print(f"[*] will use bundle id: {BUNDLE} (save this!)") print(f"[*] will use team id: {TEAM_ID}") -print(f"[*] will use bundle id: {BUNDLE}") # objectives (what we are setting): # 1. application-identifier = "." (unique)