Skip to content

Instantly share code, notes, and snippets.

@bruienne
Created January 25, 2018 17:08
Show Gist options
  • Select an option

  • Save bruienne/5f84cfa559ca957dc2943c33a3098149 to your computer and use it in GitHub Desktop.

Select an option

Save bruienne/5f84cfa559ca957dc2943c33a3098149 to your computer and use it in GitHub Desktop.

Revisions

  1. bruienne created this gist Jan 25, 2018.
    20 changes: 20 additions & 0 deletions find32bit.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    #!/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)