mirror of
https://github.com/NohamR/pyzule-rw.git
synced 2026-10-10 18:39:41 +00:00
chore: move write_entitlements() to MainExecutable
the func is only used in `MainExecutable`, so we should move it there to make it a bit more "clean"
This commit is contained in:
@@ -49,7 +49,7 @@ class Executable:
|
||||
if os.path.isfile(self.idylib):
|
||||
self.inj_func = self.idyl_inject
|
||||
else:
|
||||
self.inj_func = self.lief_inj
|
||||
self.inj_func = self.lief_inject
|
||||
|
||||
def is_encrypted(self) -> bool:
|
||||
proc = subprocess.run(
|
||||
@@ -65,17 +65,6 @@ class Executable:
|
||||
def fakesign(self) -> bool:
|
||||
return subprocess.run([self.ldid, "-S", "-M", self.path]).returncode == 0
|
||||
|
||||
def write_entitlements(self, output: str) -> bool:
|
||||
with open(output, "wb") as entf:
|
||||
proc = subprocess.run(
|
||||
[self.ldid, "-e", self.path],
|
||||
capture_output=True
|
||||
)
|
||||
|
||||
entf.write(proc.stdout)
|
||||
|
||||
return os.path.getsize(output) > 0
|
||||
|
||||
def thin(self) -> bool:
|
||||
return subprocess.run(
|
||||
[self.lipo, "-thin", "arm64", self.path, "-output", self.path],
|
||||
@@ -88,7 +77,7 @@ class Executable:
|
||||
stderr=subprocess.DEVNULL
|
||||
)
|
||||
|
||||
def lief_inj(self, cmd: str) -> None:
|
||||
def lief_inject(self, cmd: str) -> None:
|
||||
if self.inj is None: # type: ignore
|
||||
try:
|
||||
lief.logging.disable() # type: ignore
|
||||
|
||||
@@ -16,7 +16,7 @@ class MainExecutable(Executable):
|
||||
FRAMEWORKS_DIR = f"{self.bundle_path}/Frameworks"
|
||||
has_entitlements = self.write_entitlements(ENT_PATH)
|
||||
|
||||
# iirc, injecting doesnt work (sometimes) if the file isn't signed
|
||||
# iirc, injecting doesnt work (sometimes) if the file is signed
|
||||
self.remove_signature()
|
||||
|
||||
if any(t.endswith(".appex") for t in tweaks):
|
||||
@@ -95,6 +95,17 @@ class MainExecutable(Executable):
|
||||
self.sign_with_entitlements(ENT_PATH)
|
||||
print("[*] restored entitlements")
|
||||
|
||||
def write_entitlements(self, output: str) -> bool:
|
||||
with open(output, "wb") as entf:
|
||||
proc = subprocess.run(
|
||||
[self.ldid, "-e", self.path],
|
||||
capture_output=True
|
||||
)
|
||||
|
||||
entf.write(proc.stdout)
|
||||
|
||||
return os.path.getsize(output) > 0
|
||||
|
||||
def merge_entitlements(self, entitlements: str) -> None:
|
||||
self.sign_with_entitlements(entitlements)
|
||||
print("[*] merged new entitlements")
|
||||
|
||||
Reference in New Issue
Block a user