Created
January 25, 2018 17:08
-
-
Save bruienne/5f84cfa559ca957dc2943c33a3098149 to your computer and use it in GitHub Desktop.
Find 32-bit executables in a given path. Uses the macholib module that ships with macOS.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from macholib import MachO | |
import macholib | |
import os | |
import sys | |
path = sys.argv[1] | |
for root, dirs, files in os.walk(path): | |
for file in files: | |
abs_path = os.path.join(root,file) | |
if os.access(abs_path, os.X_OK): | |
try: | |
macho = MachO.MachO(abs_path) | |
except (ValueError, KeyError): | |
break | |
if len(macho.headers) == 1: | |
if not isinstance(macho.headers[0].mach_header(), macholib.mach_o.mach_header_64): | |
print('%s' % abs_path) |
I modified the script to address the issue @aschwanb (and I) were seeing.
Since you can't seem to PR a gist, here it is: https://gist.github.com/lazymutt/d6b145f14437e9eae1e7174058618b1f
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you very much for that handy script.
I'm seeing the following error when running it against an applications folder with adobe installed:
Any idea on how to work around that problem?