Skip to content

Add support for Mach-0 macOS/iOS executables #39

Open

Description

@pombredanne

See https://en.wikipedia.org/wiki/Mach-O

They have these characteristics:

  • mimetype: application/x-mach-binary; charset=binary
  • file type: Mach-O 64-bit x86_64 executable (with variations on arch)

we should have a basic detection to qualify these as binaries and executables.

Activity

  1. pombredanne commented on Feb 15, 2024

    @pombredanne
    MemberAuthor

    A simple way to go may be:

    def is_macho(self):
        return (
            self.filetype_file.lower().startswith('mach-o')
            or self.mimetype_file.lower().startswith("application/x-mach-binary")
        )
    

    or from a file location

    def is_macho(location):
        t = get_type(location)
        return (
            t.filetype_file.lower().startswith('mach-o')
            or t.mimetype_file.lower().startswith("application/x-mach-binary")
        )
    
  2. pombredanne commented on Feb 15, 2024

    @pombredanne
    MemberAuthor

    A small truncated file is enough for testing:
    For instance:
    head -c 100 GoReSym_mac > bar and bar is only 100 bytes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions