diff --git a/README.md b/README.md index f4190a5..826df9c 100644 --- a/README.md +++ b/README.md @@ -26,6 +26,8 @@ first, make sure you have [ar](https://command-not-found.com/ar) and [tar](https also obviously install python, version 3.9 or greater is required +the `zip` and `unzip` commands are *optional* dependencies, they may [fix issues when extracting certain IPAs with chinese characters](https://github.com/asdfzxcvbn/pyzule-rw/wiki/file-does-not-exist-(executable)-%3F), etc +
linux/WSL/macOS instructions
diff --git a/cyan/extras/Cephei.framework/Info.plist b/cyan/extras/Cephei.framework/Info.plist index 5fbbb2d..c1212d1 100644 --- a/cyan/extras/Cephei.framework/Info.plist +++ b/cyan/extras/Cephei.framework/Info.plist @@ -4,24 +4,34 @@ CFBundleDevelopmentRegion English + CFBundleExecutable Cephei + CFBundleIdentifier ws.hbang.common + CFBundleInfoDictionaryVersion 6.0 + CFBundleName Cephei + CFBundlePackageType BNDL + CFBundleShortVersionString 1.0.0 + CFBundleSignature ???? + CFBundleVersion 1.0 + DTPlatformName iphoneos + HBPackageIdentifier ws.hbang.common diff --git a/cyan/extras/CepheiPrefs.framework/Info.plist b/cyan/extras/CepheiPrefs.framework/Info.plist index 3b60382..773a200 100644 --- a/cyan/extras/CepheiPrefs.framework/Info.plist +++ b/cyan/extras/CepheiPrefs.framework/Info.plist @@ -4,26 +4,37 @@ CFBundleDevelopmentRegion English + CFBundleExecutable CepheiPrefs + CFBundleIdentifier ws.hbang.common.prefs + CFBundleInfoDictionaryVersion 6.0 + CFBundleName Cephei + CFBundlePackageType BNDL + CFBundleShortVersionString 1.0.0 + CFBundleSignature ???? + CFBundleVersion 1.0 + DTPlatformName iphoneos + HBPackageIdentifier ws.hbang.common + NSPrincipalClass HBDemoRootListController diff --git a/cyan/extras/CepheiUI.framework/Info.plist b/cyan/extras/CepheiUI.framework/Info.plist index 1ae90ba..bf601a1 100644 Binary files a/cyan/extras/CepheiUI.framework/Info.plist and b/cyan/extras/CepheiUI.framework/Info.plist differ diff --git a/cyan/tbhtypes/executable.py b/cyan/tbhtypes/executable.py index a7ad879..08b966e 100644 --- a/cyan/tbhtypes/executable.py +++ b/cyan/tbhtypes/executable.py @@ -35,7 +35,12 @@ class Executable: def __init__(self, path: str, bundle_path: Optional[str] = None): if not os.path.isfile(path): - sys.exit(f"[!] {path} does not exist (executable)") + print(f"[!] {path} does not exist (executable)", file=sys.stderr) + sys.exit( + "[?] check the wiki for info: " + "https://github.com/asdfzxcvbn/pyzule-rw/wiki/" + "file-does-not-exist-(executable)-%3F" + ) self.path = path self.bundle_path = bundle_path diff --git a/cyan/tbhutils.py b/cyan/tbhutils.py index ea6fc1e..a8fda0e 100644 --- a/cyan/tbhutils.py +++ b/cyan/tbhutils.py @@ -10,6 +10,9 @@ from glob import glob, iglob from argparse import Namespace from typing import Optional, Any +HAS_ZIP = shutil.which("zip") is not None +HAS_UNZIP = shutil.which("unzip") is not None + def validate_inputs(args: Namespace) -> Optional[str]: if not ( @@ -81,7 +84,15 @@ def get_app(path: str, tmpdir: str, is_ipa: bool) -> str: elif not any(name.endswith(".app/Info.plist") for name in names): sys.exit("[!] no Info.plist, invalid app") - ipa.extractall(tmpdir) + # using unzip fixes extraction errors in ipas with chinese chars, etc + if HAS_UNZIP: + subprocess.run( + ["unzip", path, "-d", tmpdir], + stdout=subprocess.DEVNULL + ) + else: + ipa.extractall(tmpdir) + app = glob(f"{payload}/*.app")[0] except (KeyError, IndexError): sys.exit("[!] couldn't find either Payload or app folder, invalid ipa") @@ -180,14 +191,25 @@ def make_ipa(tmpdir: str, output: str, level: int) -> None: os.chdir(tmpdir) weird = 0 - with zipfile.ZipFile( - output, "w", zipfile.ZIP_DEFLATED, compresslevel=level - ) as zf: - for f in iglob("Payload/**", recursive=True): - try: - zf.write(f) - except ValueError: - weird += 1 + if HAS_ZIP: + try: + os.remove(output) # zip command updates zipfiles by default + except FileNotFoundError: + pass + + subprocess.run( + ["zip", f"-{level}", "-r", output, "Payload"], + stdout=subprocess.DEVNULL + ) + else: + with zipfile.ZipFile( + output, "w", zipfile.ZIP_DEFLATED, compresslevel=level + ) as zf: + for f in iglob("Payload/**", recursive=True): + try: + zf.write(f) + except ValueError: + weird += 1 if weird != 0: print(f"[?] was unable to zip {weird} file(s) due to timestamps")