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

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

No files matched your search

-1
View File
@@ -36,7 +36,6 @@ class Executable:
)
self.path = path
self.bn = os.path.basename(path)
def is_encrypted(self) -> bool:
+5 -3
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)
print("[*] merged new 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: