fix: can't extract entitlements with codesign (ProcursusTeam/ldid#45)

this issue was originally reported in #8
This commit is contained in:
zx
2024-10-28 17:27:02 -04:00
parent c0b0324a12
commit 7543bb3d8d
2 changed files with 5 additions and 4 deletions

View File

@@ -36,7 +36,6 @@ class Executable:
)
self.path = path
self.bn = os.path.basename(path)
def is_encrypted(self) -> bool:

View File

@@ -121,12 +121,14 @@ class MainExecutable(Executable):
return os.path.getsize(output) > 0
def merge_entitlements(self, entitlements: str) -> None:
self.sign_with_entitlements(entitlements)
if self.sign_with_entitlements(entitlements):
print("[*] merged new entitlements")
else:
print("[!] failed to merge new entitlements, are they valid?")
def sign_with_entitlements(self, entitlements: str) -> bool:
return subprocess.run(
[self.ldid, f"-S{entitlements}", "-M", self.path]
[self.ldid, f"-S{entitlements}", "-M", "-Cadhoc", self.path]
).returncode == 0
def lief_inject(self, cmd: str) -> None: