macho/macho-go/tools/remove-signature.py
2023-05-31 16:17:03 +07:00

35 lines
919 B
Python

import os
import subprocess
pjoin = os.path.join
app_folder = sys.args[1]
framework_folder = pjoin(app_folder, "Frameworks")
plugin_folder = pjoin(app_folder, "Plugins")
for framework in os.listdir(framework_folder):
binary, subfix = framework.split('.')
# should read Info.plist to find out the Binary
path = ( pjoin(framework_folder, framework, binary)
, pjoin(framework_folder, framework)
) [subfix != "framework"]
r = subprocess.run([
'codesign', '--remove-signature', path
], capture_output=True)
print(path, r.returncode, r.stderr)
if (os.path.exists(plugin_folder)):
for plugin in os.listdir():
binary, _ = plugin.split('.')
r = subprocess.run([
'codesign', '--remove-signature',
pjoin(app_folder, "Plugins", plugin, binary),
], capture_output=True)
print(r.args, r.returncode, r.stderr)