feat: remove uisupporteddevices

This commit is contained in:
zx
2024-09-06 00:18:16 -04:00
parent c899ec7c22
commit dc21719157
7 changed files with 45 additions and 15 deletions

View File

@@ -1,10 +1,12 @@
from .app_bundle import AppBundle
from .executable import Executable
from .leaving_cm import LeavingCM
from .plist import Plist
__all__ = [
"AppBundle",
"Executable",
"LeavingCM"
"LeavingCM",
"Plist"
]

View File

@@ -1,14 +1,13 @@
import os
import shutil
from cyan.tbhutils import get_plist
from .executable import Executable
from .plist import Plist
class AppBundle:
def __init__(self, path: str, plist_path: str):
self.path = path
self.plist = get_plist(plist_path)
self.plist = Plist(plist_path)
self.executable = Executable(
f"{path}/{self.plist['CFBundleExecutable']}",

30
cyan/tbhtypes/plist.py Normal file
View File

@@ -0,0 +1,30 @@
import sys
import plistlib
from typing import Any
class Plist:
def __init__(self, path: str):
try:
with open(path, "rb") as f:
self.data: dict[str, Any] = plistlib.load(f)
except Exception:
sys.exit(f"[!] couldn't read {path}")
self.path = path
def __getitem__(self, key: str) -> Any:
return self.data.get(key, None)
def remove(self, key: str) -> bool:
try:
del self.data[key]
return True
except KeyError:
return False
def remove_uisd(self) -> None:
if self.remove("UISupportedDevices"):
print("[*] removed UISupportedDevices")
else:
print("[?] no UISupportedDevices")