feat: remove watch apps

This commit is contained in:
zx
2024-09-06 00:04:23 -04:00
parent 9d3f12f447
commit df3ec4ba2b
4 changed files with 43 additions and 0 deletions

View File

@@ -14,3 +14,12 @@ so to reaffirm this, **iOS is currently not supported until an updated python fo
easiest install ever, just `pip install -U git+https://github.com/asdfzxcvbn/pyzule-rw.git#egg=cyan`
## todo
[] refactor: dont prepare, just copy and fix as you go
[] feat: plist operations (-u, -n, -v, -b, -m, -d, -l, -r)
[x] feat: remove watch app
[] feat: fakesign
[] feat: thin binaries
[] feat: plugin operations (-q, -e)

View File

@@ -27,6 +27,11 @@ def main() -> None:
help="a tweak to inject/item to be added to the bundle"
)
parser.add_argument(
"-w", "--no-watch", action="store_true",
help="remove all watch apps"
)
parser.add_argument(
"-c", "--compress", metavar="level", type=int, default=6,
help="the compression level of the ipa (0-9, defaults to 6)",

View File

@@ -41,6 +41,9 @@ def main(parser: ArgumentParser) -> None:
if args.f is not None:
app.executable.inject(args.f, tmpdir)
if args.no_watch:
app.remove_watch_apps()
# create subdirectories if necessary
if "/" in args.o:
os.makedirs(os.path.dirname(args.o), exist_ok=True)

View File

@@ -1,3 +1,6 @@
import os
import shutil
from cyan.tbhutils import get_plist
from .executable import Executable
@@ -12,3 +15,26 @@ class AppBundle:
path
)
def remove(self, name: str) -> bool:
path = f"{self.path}/{name}"
if not os.path.exists(path):
return False
try:
shutil.rmtree(path)
except NotADirectoryError:
os.remove(path)
return True
def remove_watch_apps(self) -> None:
removed = False
for name in ("Watch", "WatchKit", "com.apple.WatchPlaceholder"):
if self.remove(name):
removed = True
if removed:
print("[*] removed watch app")
else:
print("[?] watch app not present")